Oh, my GoD! Goroutines on D
claptrap
clap at trap.com
Sat Jan 4 01:01:49 UTC 2025
On Thursday, 2 January 2025 at 19:59:26 UTC, Jin wrote:
>>> received 100000000 messages in 2906 msec sum=4999999950000000
>>
>
> 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.
Have you considered not wrapping the offsets, and only modulus
with the length when you index into the messages, it'll simplify
the math, IE..
messagesInQueue = producer.offet-consumer.offset
available = (Length - messagesInQueue -1)
More information about the Digitalmars-d
mailing list