
On Tuesday, November 08, 2011 09:22:29 Helge Bahmann wrote:
On Tuesday 08 November 2011 04:42:38 Andrey Semashev wrote:
Another option that I have considered would be "piggy-backing" the spinlock pool into Boost.Thread -- the idea is that an application is either single-threaded, or if it is multi-threaded it is expected to link with Boost.Thread (even if nothing from Boost.Thread is used indeed, yes makes me feel uneasy as well).
I think this might be a good idea. Boost.Thread usage in multi-threaded apps is quite expected.
In that case I could play "weak reference" tricks such that the pool is used when linked in, and for single-threaded applications no mutual exclusion is done and they work just fine nevertheless.
Too whacky? Maybe piggy-backing into Boost.Thread without weak reference tricks might also be something to consider?
I didn't really understand the trick, but it seems odd to use atomic<> in single-threaded apps.