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 implementation. > Problems: > > For blocking thread i use loop with Thread.sleep - this is bad decision > IMHO. Have a look at this exponential backoff implementation for my GC spinlock PR. https://github.com/D-Programming-Language/druntime/pull/1447/files#diff-fb5cbe06e1aaf83814ccf5ff08f05519R34 In general you need some sort of configurable or adaptive backoff or you'll waste too much time context switching. -Martin