
Andrey Semashev <andysem@mail.ru> writes:
Hello Anthony,
Tuesday, August 28, 2007, 12:17:45 PM, you wrote:
"Peter Dimov" <pdimov@pdimov.com> writes:
Hasn't Anthony Williams already implemented a header-only call_once? I'm not sure I see a reason to reinvent that particular wheel. Once boost::mutex is made header-only, there'd be no need for lightweight_mutex either and I'll be able to retire it as well.
I have implemented a header-only call_once for Windows --- on the thread_rewrite branch in SVN. I plan to get to pthreads sometime in the near future.
The win32 implementation of mutex is also header-only, and I plan to add a header-only pthreads implementation too.
Would you be interested to take a look at my implementation? Maybe after some cleaning up it could be moved to your official library?
Sorry for the delay in replying. I've looked at the implementation in FSM.zip from the vault --- is that the one you meant? --- and with a quick glance it looks like you've opted for a check/sleep/check/sleep loop for threads that are waiting for another thread to finish running the routine. This is a bad idea. Blocking of this nature should be done by waiting on an OS primitive rather than with a wait loop. Anthony -- Anthony Williams Just Software Solutions Ltd - http://www.justsoftwaresolutions.co.uk Registered in England, Company Number 5478976. Registered Office: 15 Carrallack Mews, St Just, Cornwall, TR19 7UL