[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: userdata and the gc
- From: Chris Marrin <chris@...>
- Date: Tue, 18 Apr 2006 06:08:12 -0700
Adrian Sietsma wrote:
My specific problem is thread-related - can I pass a (referenced) full
userdata pointer to another thread for background i/o, trusting that Lua
will _never_ delete (or move) the memory pointed to, as long as the ud
stays referenced ?
Why not just point the userdata at a memory block that you allocate and
then pass that to the other thread? Since you allocate it, you can be
sure its address will not be changed by Lua, even if the userdata
pointing at it moves around.
chris marrin ,""$, "As a general rule,don't solve puzzles
firstname.lastname@example.org b` $ that open portals to Hell" ,,.
,.` ,b` ,` , 1$'
,|` mP ,` :$$' ,mm
,b" b" ,` ,mm m$$ ,m ,`P$$
m$` ,b` .` ,mm ,'|$P ,|"1$` ,b$P ,` :$1
b$` ,$: :,`` |$$ ,` $$` ,|` ,$$,,`"$$ .` :$|
b$| _m$`,:` :$1 ,` ,$Pm|` ` :$$,..;"' |$:
P$b, _;b$$b$1" |$$ ,` ,$$" ``' $$
```"```'" `"` `""` ""` ,P`