Oh, my GoD! Goroutines on D
Jin
nin-jin at ya.ru
Mon Jan 6 10:15:39 UTC 2025
On Thursday, 2 January 2025 at 19:59:26 UTC, Jin wrote:
> Bad news. Sometimes I get incorrect results and I can't figure
> out why.
> I use the atomic acquire and release operations, although they
> are not required on x86, but I hope the compiler takes them
> into account and does not reorder instructions. But even with
> stricter memory barriers, I don't get a very stable result. If
> someone can tell me what could be wrong here, I would be very
> grateful.
I found a bug. I first checked if there was anything in the
queue, and if not, I checked if the queue was finalized.
Sometimes the queue would fill up between these two steps and I
would lose data. I moved the finalization check to the beginning
and now everything is stable.
More information about the Digitalmars-d
mailing list