Re: Segmentation fault: Lua and pthread
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Segmentation fault: Lua and pthread
- From: Javier Guerra <javier@...>
- Date: 2009年6月19日 23:17:02 -0500
Duboucher Thomas wrote:
> In llimits.h, you have also an interesting piece of code
>
> #ifndef lua_lock
> #define lua_lock(L) ((void) 0)
> #define lua_unlock(L) ((void) 0)
> #endif
>
> #ifndef luai_threadyield
> #define luai_threadyield(L) {lua_unlock(L); lua_lock(L);}
> #endif
>
> I'm not 100% sure, but I remember that it's a way to have a thread safe
> Lua librairy while using different Lua threads into different C threads.
> The only drawback is that you need to rebuild your own Lua librairy.
right, that's what LuaThread does. it redefines those macros to make sure no related threads are run at the same time.
--
Javier