Wait-free thread communication

Martin Nowak via Digitalmars-d digitalmars-d at puremagic.com
Sun Jan 10 13:25:34 PST 2016

On 01/08/2016 05:58 PM, Jin wrote:
> Idea: no mutex, no CAS, only one direction queues without any locks.
> My prototype (https://github.com/nin-jin/go.d) is up to 10x faster than
> std.concurrency.send/receive

Yes single-reader single-writer queue are the fastest way for
inter-thread communication.
You might have a look at my
[lock-free](http://code.dlang.org/packages/lock-free) for a correct

> Problems:
> For blocking thread i use loop with Thread.sleep - this is bad decision

Have a look at this exponential backoff implementation for my GC
spinlock PR.

In general you need some sort of configurable or adaptive backoff or
you'll waste too much time context switching.


More information about the Digitalmars-d mailing list