I ran this snippet from os import sleep from random import random, randomize from times import cpuTime import threadpool var chan: Channel[string] chan.open proc chanWaiting() {.thread.} = let start = cpuTime() var lastTime = cpuTime() while true: let current = cpuTime() if current - lastTime > 0.25: echo "Already waiting for ", current - start lastTime = current var res = tryRecv chan if res.dataAvailable: echo "Got message: ", res.msg break proc chanSending(sleeping: int) {.thread.}= let msg = "Hello nice world" let hold = random sleeping echo "Hold it first for ", hold, " ms" sleep hold chan.send msg proc main = randomize() let sleeping = 2000 # 2 seconds let start = cpuTime() spawn chanWaiting() spawn chanSending(sleeping) sync() echo "Operation is finished after ", cpuTime() - start main()
However, when I compiled it with `--cc:vcc` , it's only running the spawned of `chanWaiting` and never sending the message in `chanSending`. Using gcc is no problem. Does anyone have idea why? Thanks in advance.