blob: 127ed456e4479042eeda60d4791ad279025afc2d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
discard """
output: '''
In doStuff()
In initProcess()
TEST
initProcess() done
Crashes before getting here!
'''
joinable: false
"""
import std/os
import std/threads
proc whatever() {.thread, nimcall.} =
echo("TEST")
proc initProcess(): void =
echo("In initProcess()")
var thread: Thread[void]
createThread(thread, whatever)
joinThread(thread)
echo("initProcess() done")
proc doStuff(): void =
echo("In doStuff()")
# ...
initProcess()
sleep(500)
# ...
echo("Crashes before getting here!")
doStuff()
|