diff options
author | moteus <mimir@newmail.ru> | 2013-12-26 19:09:21 +0400 |
---|---|---|
committer | moteus <mimir@newmail.ru> | 2013-12-26 19:09:21 +0400 |
commit | 1e6ac084cf3f3b44295a55f0102dcbc4907c6fbb (patch) | |
tree | 1dcbe7cc746412c247429879c073ce8da4cb1175 | |
parent | d19ff5561a442e18953130e0f21ac97b9bac4618 (diff) | |
download | lua-llthreads2-1e6ac084cf3f3b44295a55f0102dcbc4907c6fbb.tar.gz lua-llthreads2-1e6ac084cf3f3b44295a55f0102dcbc4907c6fbb.tar.bz2 lua-llthreads2-1e6ac084cf3f3b44295a55f0102dcbc4907c6fbb.zip |
Fix. Register LuaJIT built-in libraries.
-rw-r--r-- | .travis.yml | 1 | ||||
-rw-r--r-- | src/llthread.c | 18 | ||||
-rw-r--r-- | test/test_register_ffi.lua | 14 |
3 files changed, 32 insertions, 1 deletions
diff --git a/.travis.yml b/.travis.yml index 7162735..96cab16 100644 --- a/.travis.yml +++ b/.travis.yml | |||
@@ -50,6 +50,7 @@ script: | |||
50 | - lua$LUA_SFX test_register_llthreads.lua | 50 | - lua$LUA_SFX test_register_llthreads.lua |
51 | - lua$LUA_SFX test_join_timeout.lua | 51 | - lua$LUA_SFX test_join_timeout.lua |
52 | - lua$LUA_SFX test_join_detach.lua | 52 | - lua$LUA_SFX test_join_detach.lua |
53 | - lua$LUA_SFX test_register_ffi.lua | ||
53 | 54 | ||
54 | notifications: | 55 | notifications: |
55 | email: | 56 | email: |
diff --git a/src/llthread.c b/src/llthread.c index b61bf11..5bcd821 100644 --- a/src/llthread.c +++ b/src/llthread.c | |||
@@ -357,9 +357,25 @@ static void open_thread_libs(lua_State *L){ | |||
357 | L_REGLIB(L, os, 1); | 357 | L_REGLIB(L, os, 1); |
358 | L_REGLIB(L, math, 1); | 358 | L_REGLIB(L, math, 1); |
359 | L_REGLIB(L, table, 1); | 359 | L_REGLIB(L, table, 1); |
360 | L_REGLIB(L, debug, 1); | ||
361 | L_REGLIB(L, string, 1); | 360 | L_REGLIB(L, string, 1); |
362 | 361 | ||
362 | #ifdef LUA_DBLIBNAME | ||
363 | L_REGLIB(L, debug, 1); | ||
364 | #endif | ||
365 | |||
366 | #ifdef LUA_BITLIBNAME | ||
367 | L_REGLIB(L, bit, 1); | ||
368 | #endif | ||
369 | |||
370 | #ifdef LUA_JITLIBNAME | ||
371 | L_REGLIB(L, jit, 1); | ||
372 | #endif | ||
373 | |||
374 | #ifdef LUA_FFILIBNAME | ||
375 | L_REGLIB(L, ffi, 1); | ||
376 | #endif | ||
377 | |||
378 | |||
363 | lua_settop(L, top); | 379 | lua_settop(L, top); |
364 | #undef L_REGLIB | 380 | #undef L_REGLIB |
365 | } | 381 | } |
diff --git a/test/test_register_ffi.lua b/test/test_register_ffi.lua new file mode 100644 index 0000000..e98167f --- /dev/null +++ b/test/test_register_ffi.lua | |||
@@ -0,0 +1,14 @@ | |||
1 | if jit then | ||
2 | local llthreads = require "llthreads" | ||
3 | local thread = llthreads.new([[ | ||
4 | if not package.preload.ffi then | ||
5 | print("ffi does not register in thread") | ||
6 | os.exit(-1) | ||
7 | end | ||
8 | local ok, err = pcall(require, "ffi") | ||
9 | if not ok then | ||
10 | print("can not load ffi: ", err) | ||
11 | os.exit(-2) | ||
12 | end | ||
13 | ]]):start():join() | ||
14 | end | ||