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

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

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(); auto thread = Thread.getAll.filter!(x => x.id == threadId).front; 2. Check the `isRunning` property. The indirection with spawn() is awkward. Thanks for the answer. I

Handling signals in D

2018-12-25 Thread Norbert Preining via Digitalmars-d-learn
Hello everyone, we are writing a program that synchronizes the OneDrive cloud service with the local computer, and run it as daemon in the background. To ensure proper database shutdown on exit, we need to install signal handlers that react to SIGINT etc. The problem now is that at the same

Re: cas and interfaces

2018-12-25 Thread Johannes Loher via Digitalmars-d-learn
On Monday, 24 December 2018 at 11:23:32 UTC, Johan Engelen wrote: On Sunday, 23 December 2018 at 14:07:04 UTC, Johannes Loher wrote: [...] The types of the 2nd and 3rd arguments of `cas` do not have to be the same, and aren't in your case. I think what's happening is that you are

Re: class template conflict

2018-12-25 Thread Michelle Long via Digitalmars-d-learn
On Tuesday, 25 December 2018 at 18:34:04 UTC, bauss wrote: On Monday, 24 December 2018 at 00:24:05 UTC, Michelle Long wrote: More simple is : do not use the same identifier ;) The whole point is to use the same identifier ;/ I think there is a bigger problem at stake here in terms of

Re: class template conflict

2018-12-25 Thread Neia Neutuladh via Digitalmars-d-learn
On Tue, 25 Dec 2018 18:34:04 +, bauss wrote: > I think there is a bigger problem at stake here in terms of software > architecture. > > What's the point needed for them to have the same identifier? A probably abstract base class with only one child class. Normally you have "Foo" and

Re: DSFML linking fails

2018-12-25 Thread bauss via Digitalmars-d-learn
On Monday, 24 December 2018 at 10:08:25 UTC, Dmitriy wrote: Hello. I'm using https://github.com/Jebbs/DSFML library [...] Create an issue here: https://github.com/Jebbs/DSFML/issues

Re: class template conflict

2018-12-25 Thread bauss via Digitalmars-d-learn
On Monday, 24 December 2018 at 00:24:05 UTC, Michelle Long wrote: More simple is : do not use the same identifier ;) The whole point is to use the same identifier ;/ I think there is a bigger problem at stake here in terms of software architecture. What's the point needed for them to have

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

Re: Determination of thread status.

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

Re: class template conflict

2018-12-25 Thread Neia Neutuladh via Digitalmars-d-learn
On Tue, 25 Dec 2018 16:55:36 +, Neia Neutuladh wrote: And I forgot part of it. Let's say we did the work to make this function: class X {} template X(int N) { // `: X` somehow refers to the X in the outer scope class X : X {} } How do you distinguish between the

Re: class template conflict

2018-12-25 Thread Neia Neutuladh via Digitalmars-d-learn
On Tue, 25 Dec 2018 13:03:13 +, Michelle Long wrote: > But I am not talking about inside the template being used. The whole > point of doing this is so that one can refer to the base class using the > same name as the derived with a template parameter to make a composite > structure. The

Re: Qualified class opEquals()

2018-12-25 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 25 December 2018 at 14:27:39 UTC, Per Nordlöw wrote: This is a severe limitation. Are there any plans on fixing this or do I have to wait for Andrei's proposed ProtoObject? Ignore opEquals and use your own interface.

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

Re: Qualified class opEquals()

2018-12-25 Thread Per Nordlöw via Digitalmars-d-learn
On Tuesday, 25 December 2018 at 00:32:55 UTC, Paul Backus wrote: No, because equality comparison between classes lowers to `object.opEquals` [1], which takes both parameters as `Object`. This is a severe limitation. Are there any plans on fixing this or do I have to wait for Andrei's proposed

Re: class template conflict

2018-12-25 Thread Michelle Long via Digitalmars-d-learn
On Monday, 24 December 2018 at 22:55:55 UTC, Daniel Kozak wrote: ne 23. 12. 2018 13:10 odesílatel Michelle Long via Digitalmars-d-learn < digitalmars-d-learn@puremagic.com> napsal: class X { } class X(int N) : X { } Is there any real reason we can't do this? Actually yes. It would