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: Michael Sparmann <theseven_at_gmx.net>
Date: Sat, 10 Mar 2012 22:44:32 +0100

>>> 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).

No need to look at the actual mutex, just have a volatile bool
i2c_in_use that you set to true after locking the mutex and to false
before releasing it. Then skip the hold switch reading part of the tick
task if that flag is set to true.


Received on 2012-03-10

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