[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: lua_Alloc thread safety
- From: Coroutines <coroutines@...>
- Date: Sun, 23 Mar 2014 15:29:40 -0700
On Sun, Mar 23, 2014 at 3:22 PM, Rena <firstname.lastname@example.org> wrote:
> Would it be safe to do something like:
> void *ud = NULL;
> lua_Alloc alloc = lua_getallocf(L, &ud);
> void *buf = alloc(ud, NULL, 0, newsize);
> while L may be being used by another thread?
> If not, would it be safe to call the allocator without calling
> lua_getallocf() in the same circumstance, having saved it when creating the
> Lua state?
> Sent from my Game Boy.
Don't know the answer to this, but you could look at lua_getallocf()
and in Lua's source and see if it has lua_lock()/lua_unlock() around
its body ? Would be a good indication it needs to lock the state