RE: How to use sv_dup_inc() ?

[email protected] (Jeremy) Tue, 22 Jul 2014 09:00:00 +0000
Newsgroups perl.xs
Message-ID <[email protected]>
--_ca96a9ea-b4f0-4f34-8cd3-a0e882b4f111_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi=2C
Not sure if this helps or not:
Are the contexts across threads? Are the contexts using a different instanc=
e of the interpreter that created the SV's? If the answer is yes to either=
=2C then you will have problems.=20
I use a similar design approach in one of my apps (the contexts are running=
 in different threads and interpreters) and the only way I could get this w=
orking was to serialize the data before sending it over (I used storable to=
 serialize =2C which I call from XS). The contexts are connected together w=
ith C based event queues.=20
I was using an old version of Perl=2C so perhaps things have changed...=20
Regards=2C
=20

Date: Tue=2C 22 Jul 2014 10:17:28 +0200
From: [email protected]
To: [email protected]
Subject: How to use sv_dup_inc() ?

Hi=2C
I am working on a XS module in which I have to transmit and share data betw=
een multiples contexts.
To simplify=2C this system is constructed around two methods:
    - send(<name>=2C <data>)
    - receive(<name>) : <data>
Send and receive are called from two different contexts and the destination=
 context can't be known in advance. (I have the insurance that the data wil=
l be used in the destination context before the destruction of the sender c=
ontext).
In my initial code I have some problems of double free during the destructi=
on of the contexts (panic: free from wrong pool). I think that I have to us=
e sv_dup_inc() to solve this issue but I may have miss something because I =
get a Seg. fault in S_ptr_table_find (tbl=3D0x0=2C sv=3D0xa0b5a8) at sv.c:1=
2197
So could you help me to find how to use sv_dup_inc() correctly?

Thanks!
Tristan 		 	   		  =

--_ca96a9ea-b4f0-4f34-8cd3-a0e882b4f111_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<style><!--
.hmmessage P
{
margin:0px=3B
padding:0px
}
body.hmmessage
{
font-size: 12pt=3B
font-family:Calibri
}
--></style></head>
<body class=3D'hmmessage'><div dir=3D'ltr'>Hi=2C<div><br></div><div>Not sur=
e if this helps or not:</div><div><br></div><div>Are the contexts across th=
reads? Are the contexts using a different instance of the interpreter that =
created the SV's? If the answer is yes to either=2C then you will have prob=
lems.&nbsp=3B</div><div><br></div><div>I use a similar design approach in o=
ne of my apps (the contexts are running in different threads and interprete=
rs) and the only way I could get this working was to serialize the data bef=
ore sending it over (I used storable to&nbsp=3Bserialize&nbsp=3B=2C which I=
 call from&nbsp=3BXS). The contexts are connected together with C based eve=
nt queues.&nbsp=3B</div><div><br></div><div>I was using an old version of P=
erl=2C so perhaps things have changed...&nbsp=3B</div><div><br></div><div>R=
egards=2C</div><div><br></div><div>&nbsp=3B</div><div><br><br><div><hr id=
=3D"stopSpelling">Date: Tue=2C 22 Jul 2014 10:17:28 +0200<br>From: tristan.=
[email protected]<br>To: [email protected]<br>Subject: How to use sv_dup_inc=
() ?<br><br><div style=3D"font-family:times new roman=2C new york=2C times=
=2C serif=3Bfont-size:12pt=3Bcolor:#000000=3B"><div>Hi=2C</div><div><br>I a=
m working on a XS module in which I have to transmit and share data between=
 multiples contexts.<br>To simplify=2C this system is constructed around tw=
o methods:<br>&nbsp=3B&nbsp=3B &nbsp=3B- send(&lt=3Bname&gt=3B=2C &lt=3Bdat=
a&gt=3B)<br>&nbsp=3B&nbsp=3B &nbsp=3B- receive(&lt=3Bname&gt=3B) : &lt=3Bda=
ta&gt=3B<br>Send and receive are called from two different contexts and the=
 destination context can't be known in advance. </div><div>(I have the insu=
rance that the data will be used in the destination context before the dest=
ruction of the sender context).</div><div><br>In my initial code I have som=
e problems of double free during the destruction of the contexts (panic: fr=
ee from wrong pool). </div><div>I think that I have to use sv_dup_inc() to =
solve this issue but I may have miss something because I get a Seg. fault i=
n S_ptr_table_find (tbl=3D0x0=2C sv=3D0xa0b5a8) at sv.c:12197<br>So could y=
ou help me to find how to use sv_dup_inc() correctly?<br><br>Thanks!<br>Tri=
stan</div></div></div></div> 		 	   		  </div></body>
</html>=

--_ca96a9ea-b4f0-4f34-8cd3-a0e882b4f111_--