-
Notifications
You must be signed in to change notification settings - Fork 34
Closed
Description
Nim compiles and runs well. Yet NimLime complains a lot. Here's the code:
# Code from: https://github.com/nim-lang/Nim/issues/2257#issuecomment-87856997
import threadpool
const ch_max:int = 3
var channels: array[1..ch_max, Channel[string]] # TChannel deplicated.
proc consumer(ix : int) {.thread.} =
echo "received: " & channels[ix].recv()
proc main =
for ix in countup(1,ch_max):
echo "opening: " & $ix & "/" & $ch_max
channels[ix].open()
for ix in countup(1,ch_max):
echo "spawning: " & $ix & "/" & $ch_max
spawn consumer(ix)
for ix in countup(1,ch_max):
echo "sending: " & $ix & "/" & $ch_max
channels[ix].send("channel recv " & $ix)
sync()
echo "synced"
for ix in countup(1,ch_max): channels[ix].close()
when isMainModule:
echo "<<begin>>"
main()
echo "<<end>>"
And this Warning: Not GC-safe with code blow. No such warning using nim c -r. That scares.
type Man = ref object of RootObj
method run(this: Man) {.base.} =
echo "running"
var bob = new Man
bob.run()Nim Compiler Version 0.17.2 (2017-09-07) [Windows: amd64]
Metadata
Metadata
Assignees
Labels
No labels