diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2017-01-24 12:07:38 +0100 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2017-01-24 12:07:44 +0100 |
commit | eb96eaa5c211963f0881dc8729204c209ebdeb5d (patch) | |
tree | e415ed145750ac796c985985ea456b0564933767 /tests/threads | |
parent | 0ead17bf0ecb12e32f64c050f8d28f6c22a59adb (diff) | |
download | Nim-eb96eaa5c211963f0881dc8729204c209ebdeb5d.tar.gz |
onThreadDestruction feature added to Nim's threading model
Diffstat (limited to 'tests/threads')
-rw-r--r-- | tests/threads/tonthreadcreation.nim | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/threads/tonthreadcreation.nim b/tests/threads/tonthreadcreation.nim index c96e86d4d..5d9b777b8 100644 --- a/tests/threads/tonthreadcreation.nim +++ b/tests/threads/tonthreadcreation.nim @@ -1,5 +1,6 @@ discard """ - output: '''some string here''' + output: '''some string here +dying some string here''' """ var @@ -10,11 +11,15 @@ proc setPerThread() = {.gcsafe.}: deepCopy(perThread, someGlobal) +proc threadDied() {.gcsafe} = + echo "dying ", perThread + proc foo() {.thread.} = echo perThread proc main = onThreadCreation setPerThread + onThreadDestruction threadDied var t: Thread[void] createThread[void](t, foo) t.joinThread() |