lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On 27/06/07, bit bull <> wrote:
Hello, I read lua sources at tonight. I saw this code piece:

ldump.c  line 33-35:

why lua_unlock before lua_lock?

the state has already been locked during some initialization function,
but it must be unlocked because the writer could be a callback to the
virtual machine.
Relock just after that, for thread safety.

I find lua_lock and lua_unlock defined in Llimits.h:

Llimits.h 109-112:
#ifndef lua_lock
#define lua_lock(L)     ((void) 0)
#define lua_unlock(L)   ((void) 0)

I think lua_lock and lua_unlock is unusable, for new version?
who can let me know something about this?

you should define these if you need to use them (eg you are in an
actual multithreaded environment). By default they are off.
you should define them in luaconf.h, I guess. I never did: has anyone
as better advice?