diff options
| author | Alexey Melnichuk <mimir@newmail.ru> | 2014-06-25 10:11:17 +0500 |
|---|---|---|
| committer | Alexey Melnichuk <mimir@newmail.ru> | 2014-06-25 10:11:17 +0500 |
| commit | 3de8f797d0e235efd20fdc9c55c8068893f4fd03 (patch) | |
| tree | e995e196db486bab6edfd6023c1e41bd1875caf8 /test | |
| parent | 04dce92542c727041ae042ede83a94e0e5e5a99f (diff) | |
| download | lua-llthreads2-3de8f797d0e235efd20fdc9c55c8068893f4fd03.tar.gz lua-llthreads2-3de8f797d0e235efd20fdc9c55c8068893f4fd03.tar.bz2 lua-llthreads2-3de8f797d0e235efd20fdc9c55c8068893f4fd03.zip | |
Add. started/detached/joinable methods to thread object.
Diffstat (limited to 'test')
| -rw-r--r-- | test/test_threads_attr.lua | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/test_threads_attr.lua b/test/test_threads_attr.lua new file mode 100644 index 0000000..fbcb036 --- /dev/null +++ b/test/test_threads_attr.lua | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | local llthreads = require"llthreads.ex" | ||
| 2 | |||
| 3 | local thread = llthreads.new(function() return 1 end) | ||
| 4 | |||
| 5 | assert(not thread:started()) | ||
| 6 | |||
| 7 | -- thread is not started so this is not valid values | ||
| 8 | assert(not thread:detached()) | ||
| 9 | assert(not thread:joinable()) | ||
| 10 | |||
| 11 | assert(thread:start(true, true)) | ||
| 12 | |||
| 13 | assert(thread:detached()) | ||
| 14 | assert(thread:joinable()) | ||
| 15 | |||
| 16 | assert(thread:join()) | ||
| 17 | |||
| 18 | assert(thread:started()) | ||
| 19 | assert(not thread:alive()) | ||
| 20 | |||
| 21 | print("done!") \ No newline at end of file | ||
