How to implement Canceleable spawn() from parent

aberba karabutaworld at gmail.com
Tue Jun 30 13:44:38 UTC 2020


On Tuesday, 30 June 2020 at 12:48:32 UTC, Simen Kjærås wrote:
> On Tuesday, 30 June 2020 at 08:15:54 UTC, aberba wrote:
>> On Tuesday, 30 June 2020 at 00:33:41 UTC, Ali Çehreli wrote:
>>> On 6/29/20 4:34 PM, aberba wrote:
>>>
>>> > So with this, without the Thread.sleep() to block main from
>>> exiting, the
>>> > spawned thread  will terminate immediately.
>>>
>>> You can call core.thread.thread_joinAll at the end of main.
>> So I tried that initially but my (){ writeln(...) } wasn't 
>> printing anything in console. Could that be related to stdout 
>> buffering? The program kept running though.
>

>
> So I guess the error is elsewhere, but I'm not sure where and 
> how.

Yeah, you're right. I changed receiveTimeout() to receive() to 
try something and forgot to change it back.

Jeez, I hate myself.

Thanks.


So how can I now hide the core.thread.thread_joinAll so the 
library user doesn't have to type it themselves in main() ? I 
don't see how that can be done.



More information about the Digitalmars-d-learn mailing list