aboutsummaryrefslogtreecommitdiff
path: root/src/llthread.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/llthread.c')
-rw-r--r--src/llthread.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/llthread.c b/src/llthread.c
index 6cb437b..0449ea9 100644
--- a/src/llthread.c
+++ b/src/llthread.c
@@ -308,26 +308,26 @@ typedef struct llthread_t {
308 308
309static void open_thread_libs(lua_State *L){ 309static void open_thread_libs(lua_State *L){
310#ifdef LLTHREAD_REGISTER_STD_LIBRARY 310#ifdef LLTHREAD_REGISTER_STD_LIBRARY
311# define L_REGLIB(L, name) lua_pushcfunction(L, luaopen_##name); lua_setfield(L, -2, #name) 311# define L_REGLIB(L, name, G) lua_pushcfunction(L, luaopen_##name); lua_setfield(L, -2, #name)
312#else 312#else
313# define L_REGLIB(L, name) lua_cpcall(L, luaopen_##name, 0) 313# define L_REGLIB(L, name, G) lutil_require(L, #name, luaopen_##name, G)
314#endif 314#endif
315 315
316 int top = lua_gettop(L); 316 int top = lua_gettop(L);
317 lua_cpcall(L, luaopen_base, 0); 317 lutil_require(L, "_G", luaopen_base, 1);
318 lua_cpcall(L, luaopen_package, 0); 318 lutil_require(L, "package", luaopen_package, 1);
319 lua_settop(L, top); 319 lua_settop(L, top);
320 320
321 /* get package.preload */ 321 /* get package.preload */
322 lua_getglobal(L, "package"); lua_getfield(L, -1, "preload"); lua_remove(L, -2); 322 lua_getglobal(L, "package"); lua_getfield(L, -1, "preload"); lua_remove(L, -2);
323 323
324 L_REGLIB(L, io ); 324 L_REGLIB(L, io, 1);
325 L_REGLIB(L, os ); 325 L_REGLIB(L, os, 1);
326 L_REGLIB(L, math ); 326 L_REGLIB(L, math, 1);
327 L_REGLIB(L, table ); 327 L_REGLIB(L, table, 1);
328 L_REGLIB(L, debug ); 328 L_REGLIB(L, debug, 1);
329 L_REGLIB(L, string ); 329 L_REGLIB(L, string, 1);
330 L_REGLIB(L, llthreads ); 330 L_REGLIB(L, llthreads, 0);
331 331
332 lua_settop(L, top); 332 lua_settop(L, top);
333#undef L_REGLIB 333#undef L_REGLIB
@@ -446,7 +446,7 @@ static int llthread_start(llthread_t *this, int start_detached) {
446#ifndef USE_PTHREAD 446#ifndef USE_PTHREAD
447 this->thread = (HANDLE)_beginthreadex(NULL, 0, llthread_child_thread_run, child, 0, NULL); 447 this->thread = (HANDLE)_beginthreadex(NULL, 0, llthread_child_thread_run, child, 0, NULL);
448 if(INVALID_THREAD == this->thread){ 448 if(INVALID_THREAD == this->thread){
449 rc = -1 449 rc = -1;
450 } 450 }
451#else 451#else
452 rc = pthread_create(&(this->thread), NULL, llthread_child_thread_run, child); 452 rc = pthread_create(&(this->thread), NULL, llthread_child_thread_run, child);