[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: userdata and the gc
- From: Adrian Sietsma <adrian_groups@...>
- Date: Tue, 18 Apr 2006 23:23:39 +1000
Chris Marrin wrote:
> 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.
You mean use a lightuserdata.
That is my current approach, but I was contemplating using Lua-allocated
memory if it is safe to assume constancy of userdata.
given this from Roberto :
"We have no intention of
allowing userdata addresses to change during GC. Unlike strings, which
are an internal data in Lua, the only purpose of userdata is to be used
by C code, which prefer that things stay where they are :)"
I will now happily pass full userdata to a background thread (IOCP on
Windows, fyi).
Adrian