new API for coroutines

This commit is contained in:
Roberto Ierusalimschy
2002-11-06 17:08:00 -02:00
parent 6820da5096
commit 118347d8c3
6 changed files with 85 additions and 88 deletions

15
lapi.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lapi.c,v 1.214 2002/10/25 20:05:28 roberto Exp roberto $
** $Id: lapi.c,v 1.215 2002/10/25 21:31:28 roberto Exp roberto $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -105,6 +105,19 @@ LUA_API int lua_checkstack (lua_State *L, int size) {
}
LUA_API void lua_movethread (lua_State *from, lua_State *to, int n) {
int i;
lua_lock(to);
api_checknelems(from, n);
from->top -= n;
for (i = 0; i < n; i++) {
setobj(to->top, from->top + i);
api_incr_top(to);
}
lua_unlock(to);
}
LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) {
lua_CFunction old;
lua_lock(L);