|
Boost : |
From: John Maddock (john_at_[hidden])
Date: 2005-09-04 04:33:13
>>> I think that especially on CE, you'd really want to use a lock (on
>>> slow path) and never busy-wait... priority inversions, y'know.
>>
>> Very good point, I knew I'd missed something :-)
>
> You need Sleep(1) instead.
I thought I had, but Oh shucks, apparently not, and I *knew* that as well,
how embarrassing!
In any case as Alexander pointed out it doesn't completely help due to the
priority inversion problem, there's a good description of the issue here:
http://www.netrino.com/Publications/Glossary/PriorityInversion.html. It can
be worked around, but by the time you've done that, you may well have just
have used a mutex and let that handle the thread priorities for you (the
previously posted mutex version can be improved upon however, as can the
existing Boost.Thread code).
John.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk