On Sunday, 27 September 2020 at 10:40:25 UTC, Ali Çehreli wrote:
On 9/27/20 3:06 AM, Ferhat Kurtulmuş wrote:
Have you considered passing messages with
std.concurrency.send() and std.concurrency.receive() and
friends? You wouldn't need 'queue' because all of your threads
already have mail boxes to send messages to each other.
I remember that your book covers passing messages with send().
Probably I will rewrite it using that mechanism, you are right, I
noticed that when I run the code I can hear the boosted noise of
my desktop fan.
As an improvement when defining durations, you don't need to
"hide" units in comments:
// enum afterNmilliseconds = 1500;
// Instead:
enum after = 1500.msecs;
msecs and friends are defined in core.time:
https://dlang.org/phobos/core_time.html#.dur
Thank you for the tip. That was just a preudo-code to explain my
situation.
Thanks a lot.
Ferhat