basic thread support; still broken on Windows; untested on Mac OS X
This commit is contained in:
parent
0f743e0183
commit
66cfc851a1
17 changed files with 521 additions and 127 deletions
21
tests/gc/tthreads.nim
Normal file
21
tests/gc/tthreads.nim
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
import threads
|
||||
|
||||
var
|
||||
thr: array [0..4, TThread]
|
||||
L: TLock
|
||||
|
||||
proc threadFunc(c: pointer) {.procvar.} =
|
||||
for i in 0..9:
|
||||
Aquire(L)
|
||||
echo i
|
||||
Release(L)
|
||||
|
||||
InitLock(L)
|
||||
|
||||
for i in 0..high(thr):
|
||||
createThread(thr[i], threadFunc)
|
||||
for i in 0..high(thr):
|
||||
joinThread(thr[i])
|
||||
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue