summary refs log tree commit diff stats
path: root/tests/threads/tthreadanalysis2.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/threads/tthreadanalysis2.nim')
-rwxr-xr-xtests/threads/tthreadanalysis2.nim52
1 files changed, 0 insertions, 52 deletions
diff --git a/tests/threads/tthreadanalysis2.nim b/tests/threads/tthreadanalysis2.nim
deleted file mode 100755
index 07f0e61fd..000000000
--- a/tests/threads/tthreadanalysis2.nim
+++ /dev/null
@@ -1,52 +0,0 @@
-discard """
-  file: "tthreadanalysis2.nim"
-  line: 42
-  errormsg: "write to foreign heap"
-  cmd: "nimrod cc --hints:on --threads:on $# $#"
-"""
-
-import os
-
-var
-  thr: array [0..5, TThread[tuple[a, b: int]]]
-
-proc doNothing() = nil
-
-type
-  PNode = ref TNode
-  TNode = object {.pure.}
-    le, ri: PNode
-    data: string
-
-var
-  root: PNode
-
-proc buildTree(depth: int): PNode =
-  if depth == 3: return nil
-  new(result)
-  result.le = buildTree(depth-1)
-  result.ri = buildTree(depth-1)
-  result.data = $depth
-
-proc echoLeTree(n: PNode) =
-  var it = n
-  while it != nil:
-    echo it.data
-    it = it.le
-
-proc threadFunc(interval: tuple[a, b: int]) {.thread.} = 
-  doNothing()
-  for i in interval.a..interval.b: 
-    var r = buildTree(i)
-    echoLeTree(r) # for local data
-  root = buildTree(2) # BAD!
-  #echoLeTree(root) # and the same for foreign data :-)
-
-proc main =
-  root = buildTree(5)
-  for i in 0..high(thr):
-    createThread(thr[i], threadFunc, (i*100, i*100+50))
-  joinThreads(thr)
-
-main()
-