November 16, 2016 Re: send doesn't work | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Tuesday, 15 November 2016 at 20:46:59 UTC, Steven Schveighoffer wrote:
> From experience, this smells like a race condition.
And I have found the error! And you are right! It is really race condition.
The problem was that I had not one receiveTimeout() but 3 receiveTimeout() for each thread. I don't know how I expect that each send must go to his own receiveTimeout, but of course it was false.
Big thanks to all!
|
November 16, 2016 Re: send doesn't work | ||||
---|---|---|---|---|
| ||||
Posted in reply to unDEFER | On Tuesday, 15 November 2016 at 16:36:00 UTC, unDEFER wrote:
> The parent thread has the next code to receive it and handle:
> receiveTimeout( dur!"hnsecs"(1),
> (Tid tid)
> {//the message from child thread handler} );
I just have to wonder every time I look at this... how long is 1 hnsecs? I'd assume not very long. Either blocking unless there's no more messages, or having a longer timeout period seems a better bet.
Might make it 1-5ms.
|
November 16, 2016 Re: send doesn't work | ||||
---|---|---|---|---|
| ||||
Posted in reply to Era Scarecrow | On Wednesday, 16 November 2016 at 10:54:32 UTC, Era Scarecrow wrote:
> I just have to wonder every time I look at this... how long is 1 hnsecs? I'd assume not very long. Either blocking unless there's no more messages, or having a longer timeout period seems a better bet.
>
> Might make it 1-5ms.
Really I have wanted to write 0ms, but don't sure that it is possible.
|
November 16, 2016 Re: send doesn't work | ||||
---|---|---|---|---|
| ||||
Posted in reply to unDEFER | On 11/16/16 4:35 AM, unDEFER wrote:
> On Tuesday, 15 November 2016 at 20:46:59 UTC, Steven Schveighoffer wrote:
>
>> From experience, this smells like a race condition.
>
> And I have found the error! And you are right! It is really race condition.
> The problem was that I had not one receiveTimeout() but 3
> receiveTimeout() for each thread. I don't know how I expect that each
> send must go to his own receiveTimeout, but of course it was false.
>
> Big thanks to all!
Glad you figured it out!
-Steve
|
November 16, 2016 Re: send doesn't work | ||||
---|---|---|---|---|
| ||||
Posted in reply to unDEFER | On Wednesday, 16 November 2016 at 13:10:06 UTC, unDEFER wrote:
> On Wednesday, 16 November 2016 at 10:54:32 UTC, Era Scarecrow wrote:
>> I just have to wonder every time I look at this... how long is 1 hnsecs? I'd assume not very long. Either blocking unless there's no more messages, or having a longer timeout period seems a better bet.
>>
>> Might make it 1-5ms.
>
> Really I have wanted to write 0ms, but don't sure that it is possible.
receiveTimeout(0.seconds,
/* ... */
);
|
November 17, 2016 Re: send doesn't work | ||||
---|---|---|---|---|
| ||||
Posted in reply to Anonymouse | On Wednesday, 16 November 2016 at 20:20:07 UTC, Anonymouse wrote:
> receiveTimeout(0.seconds,
> /* ... */
> );
Thanks!
|
November 18, 2016 Re: send doesn't work | ||||
---|---|---|---|---|
| ||||
Posted in reply to unDEFER | On Thursday, 17 November 2016 at 11:37:37 UTC, unDEFER wrote:
> On Wednesday, 16 November 2016 at 20:20:07 UTC, Anonymouse wrote:
>> receiveTimeout(0.seconds,
>> /* ... */
>> );
>
> Thanks!
You can also do -1 for instant receive.
|
Copyright © 1999-2021 by the D Language Foundation