lua-users home
lua-l archive

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


> 1) Determine if two threads belong to the same shared interpreter state:
>
>   bool is_same_state(lua_State *L1, lua_State *L2) { return L1->l_G ==
L2->l_G; }
>
>   I used this for some assertions. I believe the only way around it
>   involves using the registry, and thus writing to the stack of at
>   least one of the states. This way is purely symmetrical, read-only
>   and fast.

I've had this one on my mind for a while, but I'm not convinced whether this
is a good idea.
Often multiple states are used with multiple threads (OS threads). Then your
code in unsafe.