summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/gc/gctest.nim56
-rw-r--r--tests/gc/gctest.nim.cfg1
2 files changed, 36 insertions, 21 deletions
diff --git a/tests/gc/gctest.nim b/tests/gc/gctest.nim
index f5c81f033..6d7cf9985 100644
--- a/tests/gc/gctest.nim
+++ b/tests/gc/gctest.nim
@@ -179,24 +179,38 @@ proc main() =
   write(stdout, "done!\n")
 
 var
-    father: TBNode
-    s: string
-s = ""
-s = ""
-writeLine(stdout, repr(caseTree()))
-father.t.data = @["ha", "lets", "stress", "it"]
-father.t.data = @["ha", "lets", "stress", "it"]
-var t = buildTree()
-write(stdout, repr(t[]))
-buildBTree(father)
-write(stdout, repr(father))
-
-write(stdout, "starting main...\n")
-main()
-
-GC_fullCollect()
-# the M&S GC fails with this call and it's unclear why. Definitely something
-# we need to fix!
-GC_fullCollect()
-writeLine(stdout, GC_getStatistics())
-write(stdout, "finished\n")
+  father {.threadvar.}: TBNode
+  s {.threadvar.}: string
+
+  fatherAsGlobal: TBNode
+
+proc start =
+  s = ""
+  s = ""
+  writeLine(stdout, repr(caseTree()))
+  father.t.data = @["ha", "lets", "stress", "it"]
+  father.t.data = @["ha", "lets", "stress", "it"]
+  var t = buildTree()
+  write(stdout, repr(t[]))
+  buildBTree(father)
+  write(stdout, repr(father))
+
+  write(stdout, "starting main...\n")
+  main()
+
+  GC_fullCollect()
+  # the M&S GC fails with this call and it's unclear why. Definitely something
+  # we need to fix!
+  #GC_fullCollect()
+  writeLine(stdout, GC_getStatistics())
+  write(stdout, "finished\n")
+
+#fatherAsGlobal.t.data = @["ha", "lets", "stress", "it"]
+#var tg = buildTree()
+#buildBTree(fatherAsGlobal)
+
+var thr: array[8, Thread[void]]
+for i in low(thr)..high(thr):
+  createThread(thr[i], start)
+joinThreads(thr)
+start()
diff --git a/tests/gc/gctest.nim.cfg b/tests/gc/gctest.nim.cfg
new file mode 100644
index 000000000..aed303eef
--- /dev/null
+++ b/tests/gc/gctest.nim.cfg
@@ -0,0 +1 @@
+--threads:on