You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Nim Compiler Version 2.3.1 [Linux: amd64]
Compiled at 2025-04-09
Copyright (c) 2006-2025 by Andreas Rumpf
git hash: 29a2e25
active boot switches: -d:release
Description
type
Msg =object
content: Content
Content =refobject
value: intvar chan: Channel[Msg]
var contentAddress: int# This proc will be run in another thread using the threads module.proc firstWorker() =let content = Content(value: 5)
contentAddress =cast[int](content)
echo "Sending content: ", contentAddress
chan.send(Msg(content: content))
# Initialize the channel.
chan.open()
# Launch the worker.var worker1: Thread[void]
createThread(worker1, firstWorker)
# Block until the message arrives, then print it out.let c = chan.recv()
echo "Received content: ", cast[int](c.content)
doAssert(contentAddress !=cast[int](c.content)) # FAILS HERE!!!# Wait for the thread to exit
worker1.joinThread()
With --mm:atomicArc it is. If it's not you move the references around and then you need to ensure uniqueness for this to work. IME it's easy to do that in practice but almost impossible to come up with good compiler support for it. Well there is isolate...
Nim Version
Nim Compiler Version 2.3.1 [Linux: amd64]
Compiled at 2025-04-09
Copyright (c) 2006-2025 by Andreas Rumpf
git hash: 29a2e25
active boot switches: -d:release
Description
Current Output
Expected Output
Known Workarounds
No response
Additional Information
Behaves correctly with
--gc:refc
The text was updated successfully, but these errors were encountered: