send doesn't work

Daniel Kozak via Digitalmars-d digitalmars-d at puremagic.com
Tue Nov 15 10:11:38 PST 2016


Dne 15.11.2016 v 17:36 unDEFER via Digitalmars-d napsal(a):

> Hello!
> In my thread I'm sending the Tid of the thread to the parent to inform 
> it about finishing:
> send(tid, thisTid);
>
> The parent thread has the next code to receive it and handle:
> receiveTimeout( dur!"hnsecs"(1),
>                 (Tid tid)
>                 {//the message from child thread handler} );
>
> It is good works for my first child thread.
> But, some times ago I have added the second child thread (no, no, the 
> first thread and the second thread works not simultaneously) and have 
> found that the receiving message doesn't work! The parent doesn't get 
> the message although the child sends it.
> So in my code have appeared the next insertion in the start of thread:
> /* Strange, but without sending message
>        at start thread makes not working
>        sending at end thread */
>     send(tid, "Hello");
>
> Now I have added the third child thread. At the first it have worked 
> good, but now it again doesn't receive the message. And "send 
> hello"-hack doesn't help.
> What to do? Why the sending of the message may doesn't work?
Yous should post this into Learn news group not in General. And it would 
be better if you provided full (not)working example.

and I guess you have this

receiveTimeout( dur!"hnsecs"(1),
                 (Tid tid)
                 {//the message from child thread handler} );

in some while(true) loop?


More information about the Digitalmars-d mailing list