commit d96f088a267e3ee9db938fd742dae51fb9bfb793
parent d8be9a63260134afb7792cbcd614b9640803b233
Author: Roberto Ierusalimschy <roberto@inf.puc-rio.br>
Date: Thu, 4 Aug 2005 10:36:48 -0300
'lua_lock' and similars should be hard to use
Diffstat:
2 files changed, 13 insertions(+), 26 deletions(-)
diff --git a/llimits.h b/llimits.h
@@ -1,5 +1,5 @@
/*
-** $Id: llimits.h,v 1.64 2005/03/08 20:10:05 roberto Exp roberto $
+** $Id: llimits.h,v 1.65 2005/03/09 16:28:07 roberto Exp roberto $
** Limits, basic types, and some other `installation-dependent' definitions
** See Copyright Notice in lua.h
*/
@@ -93,4 +93,14 @@ typedef lu_int32 Instruction;
#endif
+#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
+
+
#endif
diff --git a/luaconf.h b/luaconf.h
@@ -1,5 +1,5 @@
/*
-** $Id: luaconf.h,v 1.55 2005/07/11 17:10:35 roberto Exp roberto $
+** $Id: luaconf.h,v 1.56 2005/08/01 15:05:09 roberto Exp roberto $
** Configuration file for Lua
** See Copyright Notice in lua.h
*/
@@ -552,7 +552,7 @@ union luai_Cast { double l_d; long l_l; };
** if want/don't want to use _longjmp/_setjmp instead of regular
** longjmp/setjmp. By default, Lua handles errors with exceptions when
* compiling as C++ code, with _longjmp/_setjmp when compiling as C code
-** in a Unix system, and with longjmp/setjmp otherwise.
+** in some Unix systems, and with longjmp/setjmp otherwise.
*/
#if defined(__cplusplus)
/* C++ exceptions */
@@ -659,29 +659,6 @@ union luai_Cast { double l_d; long l_l; };
/*
-@@ lua_lock/lua_unlock are macros for thread synchronization inside the
-@* Lua core. This is an attempt to simplify the implementation of a
-@* multithreaded version of Lua.
-** CHANGE them only if you know what you are doing. 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)
-
-
-/*
-@@ lua_threadyield allows a thread switch in appropriate places in the core.
-** CHANGE it only if you know what you are doing. (See lua_lock.)
-*/
-#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);}
-
-
-/*
@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State
@* (the data goes just *before* the lua_State pointer).
** CHANGE (define) this if you really need that. This value must be