diff options
author | Araq <rumpf_a@web.de> | 2017-02-26 20:42:19 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2017-02-26 20:42:19 +0100 |
commit | 4f062c3be08fa2bc3e167e1a6b9842c92bc8c8f7 (patch) | |
tree | 767729cfed03cdbbb6c98be57449c66a35d06c52 /tests/threads/tonthreadcreation.nim | |
parent | df4954fac6c2b3663afbcdbd700ef73658fb4ef4 (diff) | |
download | Nim-4f062c3be08fa2bc3e167e1a6b9842c92bc8c8f7.tar.gz |
removed onThreadCreation; onThreadDestruction is now thread local
Diffstat (limited to 'tests/threads/tonthreadcreation.nim')
-rw-r--r-- | tests/threads/tonthreadcreation.nim | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/tests/threads/tonthreadcreation.nim b/tests/threads/tonthreadcreation.nim index 5d9b777b8..f588a21c9 100644 --- a/tests/threads/tonthreadcreation.nim +++ b/tests/threads/tonthreadcreation.nim @@ -7,19 +7,16 @@ var someGlobal: string = "some string here" perThread {.threadvar.}: string -proc setPerThread() = - {.gcsafe.}: - deepCopy(perThread, someGlobal) - -proc threadDied() {.gcsafe} = +proc threadDied() {.gcsafe.} = echo "dying ", perThread proc foo() {.thread.} = + onThreadDestruction threadDied + {.gcsafe.}: + deepCopy(perThread, someGlobal) echo perThread proc main = - onThreadCreation setPerThread - onThreadDestruction threadDied var t: Thread[void] createThread[void](t, foo) t.joinThread() |