Mutex obtain with timeout

Peter Dufault dufault at hda.com
Thu Dec 18 17:00:00 UTC 2014


> On Dec 18, 2014, at 11:12 , Gedare Bloom <gedare at rtems.org> wrote:
> 
> In general, I would suspect any "real-time" application that uses a
> mutex with a timeout. I suppose you could construct a valid way to use
> them, such as in a low-priority task that could lose the lock, and
> thus 'checks' for the condition. Seems complicated to me though. It
> may be sensible to remove the possibility of timeout altogether, at
> least in SMP if we can support alternate bounds.
> 

I often use pthread_mutex_timedlock(), but I bet it is always detecting an error.

For example, some event known to happen every second stops happening (loose cable?).  So the failure when the lock isn't obtained is just going to log an issue and shutdown the system.

I bet I use timedlock() more than the plain one.

But this is no longer real-time, so as long as the operation is bounded, never happens early, and is "roughly" correct (for some definition of roughly) it would work for me.

Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering




More information about the devel mailing list