diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-06-02 16:07:55 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2004-06-02 16:07:55 -0300 |
commit | e8d4fe72366dd44e45ffd9fca09d92c3db4f8214 (patch) | |
tree | d9f28bbce22a50c9e1de2f239ee6584934afb510 /luaconf.h | |
parent | b8691f13a8e3e9bb7fbd91d1f099eb517a9d5b35 (diff) | |
download | lua-e8d4fe72366dd44e45ffd9fca09d92c3db4f8214.tar.gz lua-e8d4fe72366dd44e45ffd9fca09d92c3db4f8214.tar.bz2 lua-e8d4fe72366dd44e45ffd9fca09d92c3db4f8214.zip |
new macro `lua_threadyield' + lock stuff in `luaconf.h' + details
Diffstat (limited to 'luaconf.h')
-rw-r--r-- | luaconf.h | 28 |
1 files changed, 27 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: luaconf.h,v 1.4 2004/05/28 18:32:51 roberto Exp roberto $ | 2 | ** $Id: luaconf.h,v 1.5 2004/06/02 13:24:43 roberto Exp roberto $ |
3 | ** Configuration file for Lua | 3 | ** Configuration file for Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -215,6 +215,32 @@ | |||
215 | #endif | 215 | #endif |
216 | 216 | ||
217 | 217 | ||
218 | |||
219 | /* | ||
220 | ** macros for thread synchronization inside Lua core machine: | ||
221 | ** all accesses to the global state and to global objects are synchronized. | ||
222 | ** Because threads can read the stack of other threads | ||
223 | ** (when running garbage collection), | ||
224 | ** a thread must also synchronize any write-access to its own stack. | ||
225 | ** Unsynchronized accesses are allowed only when reading its own stack, | ||
226 | ** or when reading immutable fields from global objects | ||
227 | ** (such as string values and udata values). | ||
228 | */ | ||
229 | #define lua_lock(L) ((void) 0) | ||
230 | #define lua_unlock(L) ((void) 0) | ||
231 | |||
232 | /* | ||
233 | ** this macro allows a thread switch in appropriate places in the Lua | ||
234 | ** core | ||
235 | */ | ||
236 | #define lua_threadyield(L) {lua_unlock(L); lua_lock(L);} | ||
237 | |||
238 | |||
239 | |||
240 | /* allows user-specific initialization on new threads */ | ||
241 | #define lua_userstateopen(l) /* empty */ | ||
242 | |||
243 | |||
218 | #endif | 244 | #endif |
219 | 245 | ||
220 | /* }====================================================== */ | 246 | /* }====================================================== */ |