Am 10.03.2012 22:37, schrieb Michael Sevakis:
The least invasive way to fix this bug would probably be to figure out
if I2C is already in use when trying to read the hold switch in the
tick
task, and if it is just skip updating the hold switch status for
that tick.
Really a nice hack, just one line of code to check if the mutex is
locked.
No, don't look at mutexes like that since I make no promise to not
break code peeking under their skirt. I'll write you up a
mutex_lock_w_tmo if you really must have it. Semaphore have no
priority inheritance so I wouldn't use those either because you _will_
notice when priority inversions happen (and it's not nice).
pthread has mutex_trylock() for this case. Maybe worth having it too?
Best regards.