From e8d4fe72366dd44e45ffd9fca09d92c3db4f8214 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 2 Jun 2004 16:07:55 -0300 Subject: new macro `lua_threadyield' + lock stuff in `luaconf.h' + details --- luaconf.h | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'luaconf.h') diff --git a/luaconf.h b/luaconf.h index 476b8bc1..93793e55 100644 --- a/luaconf.h +++ b/luaconf.h @@ -1,5 +1,5 @@ /* -** $Id: luaconf.h,v 1.4 2004/05/28 18:32:51 roberto Exp roberto $ +** $Id: luaconf.h,v 1.5 2004/06/02 13:24:43 roberto Exp roberto $ ** Configuration file for Lua ** See Copyright Notice in lua.h */ @@ -215,6 +215,32 @@ #endif + +/* +** macros for thread synchronization inside Lua core machine: +** all accesses to the global state and to global objects are synchronized. +** Because threads can read the stack of other threads +** (when running garbage collection), +** a thread must also synchronize any write-access to its own stack. +** Unsynchronized accesses are allowed only when reading its own stack, +** or when reading immutable fields from global objects +** (such as string values and udata values). +*/ +#define lua_lock(L) ((void) 0) +#define lua_unlock(L) ((void) 0) + +/* +** this macro allows a thread switch in appropriate places in the Lua +** core +*/ +#define lua_threadyield(L) {lua_unlock(L); lua_lock(L);} + + + +/* allows user-specific initialization on new threads */ +#define lua_userstateopen(l) /* empty */ + + #endif /* }====================================================== */ -- cgit v1.2.3-55-g6feb