discard """ cmd: "nim c --mm:yrc -d:useMalloc --threads:on $file" output: "ok" valgrind: "leaks" disabled: "windows" disabled: "freebsd" disabled: "openbsd" """ # Test sharing a cyclic list between threads under YRC. type Node = ref object value: int next: Node proc newCycle(start, count: int): Node = ## Create a cyclic linked list: start -> start+1 -> ... -> start+count-1 -> start result = Node(value: start) var cur = result for i in 1.. 1 -> 2 -> 3 -> 4 -> 0 shared = newCycle(0, NodesPerCycle) let expectedSharedSum = 0 + 1 + 2 + 3 + 4 # = 10 for i in 0..