28 Nov
2007
28 Nov
'07
6:51 a.m.
On Tue, Nov 27, 2007 at 08:25:27PM +0100, Lars Hagström wrote:
Hmm, I've been thinking about this a little bit more, and I've more and more started to like the idea (not for its beauty, but more for its practicality)...
I think this approach is a bad idea. Even if the application itself does not hold the mutex for a long time (measured in CPU time), it may be preempted and/or stopped for arbitrary amounts of time (eg. think swapping). If this happens after it has acquired a mutex, then this scheme will break.
Lars Hagström wrote:
Of course this assumes that locks are never held for "a long time", and is quite easily considered a horrible solution... But it may well work in many situations.