diff options
-rw-r--r-- | llimits.h | 10 | ||||
-rw-r--r-- | lstate.c | 9 | ||||
-rw-r--r-- | ltests.h | 4 |
3 files changed, 12 insertions, 11 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llimits.h,v 1.76 2009/12/17 12:26:09 roberto Exp roberto $ | 2 | ** $Id: llimits.h,v 1.77 2009/12/17 12:50:20 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 | */ |
@@ -139,19 +139,19 @@ typedef lu_int32 Instruction; | |||
139 | ** created/deleted/resumed/yielded. | 139 | ** created/deleted/resumed/yielded. |
140 | */ | 140 | */ |
141 | #if !defined(luai_userstateopen) | 141 | #if !defined(luai_userstateopen) |
142 | #define luai_userstateopen(L) ((void)L) | 142 | #define luai_userstateopen(L) ((void)L) |
143 | #endif | 143 | #endif |
144 | 144 | ||
145 | #if !defined(luai_userstateclose) | 145 | #if !defined(luai_userstateclose) |
146 | #define luai_userstateclose(L) ((void)L) | 146 | #define luai_userstateclose(L) ((void)L) |
147 | #endif | 147 | #endif |
148 | 148 | ||
149 | #if !defined(luai_userstatethread) | 149 | #if !defined(luai_userstatethread) |
150 | #define luai_userstatethread(L,L1) ((void)L) | 150 | #define luai_userstatethread(L,L1) ((void)L) |
151 | #endif | 151 | #endif |
152 | 152 | ||
153 | #if !defined(luai_userstatefree) | 153 | #if !defined(luai_userstatefree) |
154 | #define luai_userstatefree(L) ((void)L) | 154 | #define luai_userstatefree(L,L1) ((void)L) |
155 | #endif | 155 | #endif |
156 | 156 | ||
157 | #if !defined(luai_userstateresume) | 157 | #if !defined(luai_userstateresume) |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 2.80 2010/04/14 15:14:21 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.81 2010/04/19 16:34:46 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -192,14 +192,13 @@ LUA_API lua_State *lua_newthread (lua_State *L) { | |||
192 | setthvalue(L, L->top, L1); | 192 | setthvalue(L, L->top, L1); |
193 | api_incr_top(L); | 193 | api_incr_top(L); |
194 | preinit_state(L1, G(L)); | 194 | preinit_state(L1, G(L)); |
195 | stack_init(L1, L); /* init stack */ | ||
196 | L1->hookmask = L->hookmask; | 195 | L1->hookmask = L->hookmask; |
197 | L1->basehookcount = L->basehookcount; | 196 | L1->basehookcount = L->basehookcount; |
198 | L1->hook = L->hook; | 197 | L1->hook = L->hook; |
199 | resethookcount(L1); | 198 | resethookcount(L1); |
200 | lua_assert(iswhite(obj2gco(L1))); | ||
201 | lua_unlock(L); | ||
202 | luai_userstatethread(L, L1); | 199 | luai_userstatethread(L, L1); |
200 | stack_init(L1, L); /* init stack */ | ||
201 | lua_unlock(L); | ||
203 | return L1; | 202 | return L1; |
204 | } | 203 | } |
205 | 204 | ||
@@ -208,7 +207,7 @@ void luaE_freethread (lua_State *L, lua_State *L1) { | |||
208 | LX *l = fromstate(L1); | 207 | LX *l = fromstate(L1); |
209 | luaF_close(L1, L1->stack); /* close all upvalues for this thread */ | 208 | luaF_close(L1, L1->stack); /* close all upvalues for this thread */ |
210 | lua_assert(L1->openupval == NULL); | 209 | lua_assert(L1->openupval == NULL); |
211 | luai_userstatefree(L1); | 210 | luai_userstatefree(L, L1); |
212 | freestack(L1); | 211 | freestack(L1); |
213 | luaM_free(L, l); | 212 | luaM_free(L, l); |
214 | } | 213 | } |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.h,v 2.30 2010/01/11 17:33:09 roberto Exp roberto $ | 2 | ** $Id: ltests.h,v 2.31 2010/04/12 16:07:29 roberto Exp roberto $ |
3 | ** Internal Header for Debugging of the Lua Implementation | 3 | ** Internal Header for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -62,6 +62,8 @@ struct L_EXTRA { int lock; int *plock; }; | |||
62 | #define luai_userstateopen(l) \ | 62 | #define luai_userstateopen(l) \ |
63 | (getlock(l)->lock = 0, getlock(l)->plock = &(getlock(l)->lock)) | 63 | (getlock(l)->lock = 0, getlock(l)->plock = &(getlock(l)->lock)) |
64 | #define luai_userstatethread(l,l1) (getlock(l1)->plock = getlock(l)->plock) | 64 | #define luai_userstatethread(l,l1) (getlock(l1)->plock = getlock(l)->plock) |
65 | #define luai_userstatefree(l,l1) \ | ||
66 | lua_assert(getlock(l)->plock == getlock(l1)->plock) | ||
65 | #define lua_lock(l) lua_assert((*getlock(l)->plock)++ == 0) | 67 | #define lua_lock(l) lua_assert((*getlock(l)->plock)++ == 0) |
66 | #define lua_unlock(l) lua_assert(--(*getlock(l)->plock) == 0) | 68 | #define lua_unlock(l) lua_assert(--(*getlock(l)->plock) == 0) |
67 | 69 | ||