Page 1 of 1

Will a thread or/and channel get dereferenced automatically?

Posted: Fri Dec 06, 2024 11:13 am
by Fabimawn
Hello,

I'm working on a desktop application which works with multiple thread instances to execute some commands in a CLI, but I now wonder if I manually have to dereference the thread instances when they're finished with the :release method, since it seems I can still pull data from the channels after they've finished execution.

Are the thread channels independent of the threads that pushed data into them and created them? Or how does it work exactly, since I can't seem to find a similar topic on this so quickly and on the thread documentation this isn't explained in depth.

Re: Will a thread or/and channel get dereferenced automatically?

Posted: Fri Dec 06, 2024 12:03 pm
by slime
Channel objects aren't owned by a specific thread, they're reference-counted across threads like other love objects.

Re: Will a thread or/and channel get dereferenced automatically?

Posted: Fri Dec 06, 2024 12:16 pm
by Fabimawn
Thanks!