Re: Determination of thread status.

2018-12-30 Thread Vitaly via Digitalmars-d-learn
On Sunday, 30 December 2018 at 08:24:20 UTC, Brakeran wrote: On Thursday, 27 December 2018 at 06:22:31 UTC, Vitaly wrote: Maybe use spawnLinked()? https://run.dlang.io/is/9xbyAF Thanks. At the moment, I implemented it through sending a message, and receiveTimeout receiving, if the response is

Re: Determination of thread status.

2018-12-30 Thread Brakeran via Digitalmars-d-learn
On Thursday, 27 December 2018 at 06:22:31 UTC, Vitaly wrote: Maybe use spawnLinked()? https://run.dlang.io/is/9xbyAF Thanks. At the moment, I implemented it through sending a message, and receiveTimeout receiving, if the response is not received after the timeout expires, then it is considered

Re: Determination of thread status.

2018-12-26 Thread Vitaly via Digitalmars-d-learn
Maybe use spawnLinked()? https://run.dlang.io/is/9xbyAF Thanks. At the moment, I implemented it through sending a message, and receiveTimeout receiving, if the response is not received after the timeout expires, then it is considered that the has terminated. Probably this is not right, but I

Re: Determination of thread status.

2018-12-26 Thread Bastiaan Veelo via Digitalmars-d-learn
On Wednesday, 26 December 2018 at 05:43:47 UTC, Vitaly wrote: On Tuesday, 25 December 2018 at 17:08:00 UTC, Neia Neutuladh wrote: 1. Find the Thread object: Tid threadId = spawn(&doStuff); auto thread = Thread.getAll.filter!(x => x.id == threadId).front; 2. Check the `isRunning` property.

Re: Determination of thread status.

2018-12-25 Thread Vitaly via Digitalmars-d-learn
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. Maybe I misunderstood, but the capabilities of the std.parallelism module do not allow to exchange messages with t

Re: Determination of thread status.

2018-12-25 Thread Vitaly via Digitalmars-d-learn
On Tuesday, 25 December 2018 at 17:12:13 UTC, Bastiaan Veelo wrote: 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. Thanks for the answer. I will look at the pos

Re: Determination of thread status.

2018-12-25 Thread Vitaly via Digitalmars-d-learn
On Tuesday, 25 December 2018 at 17:08:00 UTC, Neia Neutuladh wrote: 1. Find the Thread object: Tid threadId = spawn(&doStuff); auto thread = Thread.getAll.filter!(x => x.id == threadId).front; 2. Check the `isRunning` property. The indirection with spawn() is awkward. Thanks for the answ

Re: Determination of thread status.

2018-12-25 Thread Bastiaan Veelo via Digitalmars-d-learn
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 t

Re: Determination of thread status.

2018-12-25 Thread Neia Neutuladh via Digitalmars-d-learn
1. Find the Thread object: Tid threadId = spawn(&doStuff); auto thread = Thread.getAll.filter!(x => x.id == threadId).front; 2. Check the `isRunning` property. The indirection with spawn() is awkward.

Determination of thread status.

2018-12-25 Thread Vitaly via Digitalmars-d-learn
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