Determination of thread status.

Bastiaan Veelo Bastiaan at Veelo.net
Tue Dec 25 17:12:13 UTC 2018


On Tuesday, 25 December 2018 at 14:44:43 UTC, Vitaly wrote:
> Hi all.
> I can not understand how to track me that the thread has 
> finished work.
> eg:
>
> import std.concurrency;
> void myThread ()
> {
> // Do the work
> }
>
> void main ()
> {
> Tid thread = spawn (& myThread);
> // It is necessary to check whether the thread has finished its 
> work or is active.
> }
>
> Could you tell me how to do this?

std.concurrency is a low-level API. You may be looking for a 
higher level API: std.parallelism. See Task.done(), 
https://dlang.org/phobos/std_parallelism.html#.Task.done

Bastiaan.


More information about the Digitalmars-d-learn mailing list