Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: 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
>>> 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.
Received on 2012-03-10

Page template was last modified "Tue Sep 7 00:00:02 2021" The Rockbox Crew -- Privacy Policy