parent
9c2442af94
commit
f048dad7c3
2 changed files with 40 additions and 0 deletions
32
tests/threads/t7172.nim
Normal file
32
tests/threads/t7172.nim
Normal 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()
|
||||
Loading…
Add table
Add a link
Reference in a new issue