summary refs log tree commit diff stats
path: root/tests/parallel/tlet_spawn.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/parallel/tlet_spawn.nim')
-rw-r--r--tests/parallel/tlet_spawn.nim28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/parallel/tlet_spawn.nim b/tests/parallel/tlet_spawn.nim
new file mode 100644
index 000000000..853ffc443
--- /dev/null
+++ b/tests/parallel/tlet_spawn.nim
@@ -0,0 +1,28 @@
+discard """
+output: '''
+done999 999
+'''
+"""
+
+import std/[threadpool, os]
+
+proc foo(): int = 999
+
+# test that the disjoint checker deals with 'a = spawn f(); g = spawn f()':
+
+proc main =
+  parallel:
+    let f = spawn foo()
+    let b = spawn foo()
+  echo "done", f, " ", b
+
+main()
+
+# bug #13781
+proc thread(): string =
+  os.sleep(1000)
+  return "ok"
+
+var fv = spawn thread()
+sync()
+doAssert ^fv == "ok"