aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-08-04 10:37:10 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2005-08-04 10:37:10 -0300
commitd96f088a267e3ee9db938fd742dae51fb9bfb793 (patch)
tree119e95b46bd28095efa772e04ebfcc9ad19618cd
parentd8be9a63260134afb7792cbcd614b9640803b233 (diff)
downloadlua-d96f088a267e3ee9db938fd742dae51fb9bfb793.tar.gz
lua-d96f088a267e3ee9db938fd742dae51fb9bfb793.tar.bz2
lua-d96f088a267e3ee9db938fd742dae51fb9bfb793.zip
'lua_lock' and similars should be hard to use
-rw-r--r--llimits.h12
-rw-r--r--luaconf.h27
2 files changed, 13 insertions, 26 deletions
diff --git a/llimits.h b/llimits.h
index c90680a7..c63b6853 100644
--- a/llimits.h
+++ b/llimits.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llimits.h,v 1.64 2005/03/08 20:10:05 roberto Exp roberto $ 2** $Id: llimits.h,v 1.65 2005/03/09 16:28:07 roberto Exp roberto $
3** Limits, basic types, and some other `installation-dependent' definitions 3** Limits, basic types, and some other `installation-dependent' definitions
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -93,4 +93,14 @@ typedef lu_int32 Instruction;
93#endif 93#endif
94 94
95 95
96#ifndef lua_lock
97#define lua_lock(L) ((void) 0)
98#define lua_unlock(L) ((void) 0)
99#endif
100
101#ifndef luai_threadyield
102#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);}
103#endif
104
105
96#endif 106#endif
diff --git a/luaconf.h b/luaconf.h
index 398a0646..8e44b16b 100644
--- a/luaconf.h
+++ b/luaconf.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: luaconf.h,v 1.55 2005/07/11 17:10:35 roberto Exp roberto $ 2** $Id: luaconf.h,v 1.56 2005/08/01 15:05:09 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*/
@@ -552,7 +552,7 @@ union luai_Cast { double l_d; long l_l; };
552** if want/don't want to use _longjmp/_setjmp instead of regular 552** if want/don't want to use _longjmp/_setjmp instead of regular
553** longjmp/setjmp. By default, Lua handles errors with exceptions when 553** longjmp/setjmp. By default, Lua handles errors with exceptions when
554* compiling as C++ code, with _longjmp/_setjmp when compiling as C code 554* compiling as C++ code, with _longjmp/_setjmp when compiling as C code
555** in a Unix system, and with longjmp/setjmp otherwise. 555** in some Unix systems, and with longjmp/setjmp otherwise.
556*/ 556*/
557#if defined(__cplusplus) 557#if defined(__cplusplus)
558/* C++ exceptions */ 558/* C++ exceptions */
@@ -659,29 +659,6 @@ union luai_Cast { double l_d; long l_l; };
659 659
660 660
661/* 661/*
662@@ lua_lock/lua_unlock are macros for thread synchronization inside the
663@* Lua core. This is an attempt to simplify the implementation of a
664@* multithreaded version of Lua.
665** CHANGE them only if you know what you are doing. All accesses to
666** the global state and to global objects are synchronized. Because
667** threads can read the stack of other threads (when running garbage
668** collection), a thread must also synchronize any write-access to its
669** own stack. Unsynchronized accesses are allowed only when reading its
670** own stack, or when reading immutable fields from global objects (such
671** as string values and udata values).
672*/
673#define lua_lock(L) ((void) 0)
674#define lua_unlock(L) ((void) 0)
675
676
677/*
678@@ lua_threadyield allows a thread switch in appropriate places in the core.
679** CHANGE it only if you know what you are doing. (See lua_lock.)
680*/
681#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);}
682
683
684/*
685@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State 662@@ LUAI_EXTRASPACE allows you to add user-specific data in a lua_State
686@* (the data goes just *before* the lua_State pointer). 663@* (the data goes just *before* the lua_State pointer).
687** CHANGE (define) this if you really need that. This value must be 664** CHANGE (define) this if you really need that. This value must be