This commit is contained in:
flywind 2021-07-21 15:47:06 +08:00 • committed by GitHub
commit f048dad7c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 0 deletions

32
tests/threads/t7172.nim Normal file
View file

@ -0,0 +1,32 @@
discard """
output: '''
In doStuff()
In initProcess()
initProcess() done
TEST
Crashes before getting here!
'''
joinable: false
"""
import std/os
proc whatever() {.thread, nimcall.} =
echo("TEST")
proc initProcess(): void =
echo("In initProcess()")
var thread: Thread[void]
createThread(thread, whatever)
echo("initProcess() done")
joinThread(thread)
proc doStuff(): void =
echo("In doStuff()")
# ...
initProcess()
sleep(500)
# ...
echo("Crashes before getting here!")
doStuff()