Rockbox mail archiveSubject: Re: Classic holdswitch polling
Re: Classic holdswitch polling
From: Thomas Martitz <kugel_at_rockbox.org>
Date: Sat, 10 Mar 2012 22:53:45 +0100
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
>>> 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
> 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?
Received on 2012-03-10