[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lua_Alloc thread safety
- From: "Liam Devine" <liamdevine@...>
- Date: Sun, 23 Mar 2014 22:52:26 -0000
On 23/03/14 22:22, Rena 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?
>
I would say that it depends on which allocator and may be which C
runtime is being used. Lua will lock the state when getting the
allocator from the global state if you have implemented lua_lock and
lua_unlock.
--
Liam
Attachment:
signature.asc
Description: OpenPGP digital signature