With new channels I can't call createAllocShared0() because I have to call newChan instead. Unless I can combine the two, but I don't see how.
The problem is that in the proc I create the channel in, I get the ptr (using addr), but after that ptr is returned it seems to become useless. When I try to use the channel ptr I get a nil error.
Is there a trick to doing this?
https://github.com/nim-lang/threading/blob/master/tests/tchannels_simple.nim#L9
var chan = newChan[string]()
But why, Chan[T] already has reference semantics so you can pass it as is through over Chan[T]
Otherwise what you asked to do is the following (but i see no point in actually doing it)
let chanPtr = createShared(Chan[int])
chanPtr[] = newChan[int]()