summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2011-01-18 02:22:01 +0100
committerAraq <rumpf_a@web.de>2011-01-18 02:22:01 +0100
commit66cfc851a1aeb9eb8d011a8e0c53b0f8ee83f770 (patch)
tree197c0b859516210ab9d32e8da958ed05a03bbe3f /tests
parent0f743e01833290e2995756fbd459728b12d833be (diff)
downloadNim-66cfc851a1aeb9eb8d011a8e0c53b0f8ee83f770.tar.gz
basic thread support; still broken on Windows; untested on Mac OS X
Diffstat (limited to 'tests')
-rw-r--r--tests/gc/tthreads.nim21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/gc/tthreads.nim b/tests/gc/tthreads.nim
new file mode 100644
index 000000000..2ef599e53
--- /dev/null
+++ b/tests/gc/tthreads.nim
@@ -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])
+
+