summary refs log tree commit diff stats
path: root/tests/parallel/tsysspawn.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/parallel/tsysspawn.nim')
-rw-r--r--tests/parallel/tsysspawn.nim31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/parallel/tsysspawn.nim b/tests/parallel/tsysspawn.nim
new file mode 100644
index 000000000..fc7921b0e
--- /dev/null
+++ b/tests/parallel/tsysspawn.nim
@@ -0,0 +1,31 @@
+discard """
+  output: '''4
+8'''
+  cmd: "nimrod $target --threads:on $options $file"
+"""
+
+import threadpool
+
+var
+  x, y = 0
+
+proc p1 =
+  for i in 0 .. 10_000:
+    discard
+
+  atomicInc x
+
+proc p2 =
+  for i in 0 .. 10_000:
+    discard
+
+  atomicInc y, 2
+
+for i in 0.. 3:
+  spawn(p1())
+  spawn(p2())
+
+sync()
+
+echo x
+echo y