On 28 Mar 2014 at 18:17, Gavin Lambert wrote:
I had a case (with serial ports) where this locking latency was sufficiently high to be bothersome. I wrote an experimental lock-free reactor engine which appears to outperform Asio (at least on Windows) -- but it's also much more limited and doesn't provide some of the same guarantees.
For normal (particularly socket) usage it's probably not worth the hassle.
Windows has quite chunky thread switch times anyway, so as soon as you need to wait on another thread via the kernel rather than CAS lock you can forget about performance. Windows completion ports ought to be completely user space when thread A posts work to thread B, but any additional locking e.g. by ASIO can create enough stalls to send completion ports to sleep in the kernel. That said, it would be interesting to patch in TSX support to ASIO instead of its mutex and see what happens. Niall -- Currently unemployed and looking for work in Ireland. Work Portfolio: http://careers.stackoverflow.com/nialldouglas/