On Tue, 2011-07-12 at 00:12 +0200, Arnold Krille wrote:
Real-time means "as fast as possible".
Err not really.
Real-time means "Has a bounded response time", locks generally put your
completion time at the mercy of another process that is often not
designed to have a bounded response time.
It is probably more correct to say that locks should be used with
extreme caution in RT processes as their use makes the relevant part of
another thread part of the time critical response timing.
Trylock is an interesting case can can actually be used to solve some of
this, have two copies of the working data structure, one protected by a
lock, then in the RT thread call trylock and if it succeeds copy the
data protected by the lock over the data set used by the RT process and
release the lock.
If it fails then you still have a coherent set of data, and it might
succeed the next time, this is useful for UI data sets (in both
directions).
Regards, Dan.