diff options
| author | moteus <mimir@newmail.ru> | 2013-12-27 18:25:00 +0400 |
|---|---|---|
| committer | moteus <mimir@newmail.ru> | 2013-12-27 18:25:00 +0400 |
| commit | a087c2737441aad781be7e3d88775e688152ad4e (patch) | |
| tree | 582a8dd895f13eed50ff727c4fc75d5b9b48be9b /test | |
| parent | a26ecf383900e4c396958da80200cb2eb1121506 (diff) | |
| download | lua-llthreads2-a087c2737441aad781be7e3d88775e688152ad4e.tar.gz lua-llthreads2-a087c2737441aad781be7e3d88775e688152ad4e.tar.bz2 lua-llthreads2-a087c2737441aad781be7e3d88775e688152ad4e.zip | |
Add. pass cfunctions to child thread.
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_pass_cfunction.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/test_pass_cfunction.lua b/test/test_pass_cfunction.lua new file mode 100644 index 0000000..86fcd3d --- /dev/null +++ b/test/test_pass_cfunction.lua | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | local llthreads = require"llthreads" | ||
| 2 | local utils = require"utils" | ||
| 3 | |||
| 4 | local thread = llthreads.new(utils.thread_init .. [[ | ||
| 5 | require "llthreads" | ||
| 6 | local fn = ... | ||
| 7 | |||
| 8 | if type(fn) ~= 'function' then | ||
| 9 | print("ERROR! No function : ", fn, type(fn)) | ||
| 10 | os.exit(-2) | ||
| 11 | end | ||
| 12 | |||
| 13 | fn("print('Done!'); require'os'.exit(0)"):start():join() | ||
| 14 | ]], llthreads.new) | ||
| 15 | |||
| 16 | print(thread:start():join()) | ||
| 17 | os.exit(-1) \ No newline at end of file | ||
