diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2010-12-26 05:59:39 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2010-12-26 05:59:39 +0000 |
commit | f387cdef2131b2a0956ee8e4ff7221d3251b8f46 (patch) | |
tree | 00b9226241ecb83e8c92798241bb14ebcf5b6fab /firmware/export/kernel.h | |
parent | 1d460b603fded79cb879704a4d30a50318263211 (diff) | |
download | rockbox-f387cdef2131b2a0956ee8e4ff7221d3251b8f46.tar.gz rockbox-f387cdef2131b2a0956ee8e4ff7221d3251b8f46.zip |
Make mutexes a tiny bit leaner. There is no need for a separate locked semaphore since having an owning thread also indicates that it is locked. Rename member 'count' to 'recursion' since it counts reentry, not locks. Change presents no compatibility issues for plugins or codecs because the structure size goes down.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28901 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export/kernel.h')
-rw-r--r-- | firmware/export/kernel.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/firmware/export/kernel.h b/firmware/export/kernel.h index 405f6b6838..c7fcd93284 100644 --- a/firmware/export/kernel.h +++ b/firmware/export/kernel.h | |||
@@ -142,17 +142,19 @@ struct event_queue | |||
142 | struct mutex | 142 | struct mutex |
143 | { | 143 | { |
144 | struct thread_entry *queue; /* waiter list */ | 144 | struct thread_entry *queue; /* waiter list */ |
145 | int count; /* lock owner recursion count */ | 145 | int recursion; /* lock owner recursion count */ |
146 | #ifdef HAVE_PRIORITY_SCHEDULING | 146 | #ifdef HAVE_PRIORITY_SCHEDULING |
147 | struct blocker blocker; /* priority inheritance info | 147 | struct blocker blocker; /* priority inheritance info |
148 | for waiters */ | 148 | for waiters */ |
149 | bool no_preempt; /* don't allow higher-priority thread | 149 | bool no_preempt; /* don't allow higher-priority thread |
150 | to be scheduled even if woken */ | 150 | to be scheduled even if woken */ |
151 | #else | 151 | #else |
152 | struct thread_entry *thread; | 152 | struct thread_entry *thread; /* Indicates owner thread - an owner |
153 | implies a locked state - same goes | ||
154 | for priority scheduling | ||
155 | (in blocker struct for that) */ | ||
153 | #endif | 156 | #endif |
154 | IF_COP( struct corelock cl; ) /* multiprocessor sync */ | 157 | IF_COP( struct corelock cl; ) /* multiprocessor sync */ |
155 | bool locked; /* locked semaphore */ | ||
156 | }; | 158 | }; |
157 | 159 | ||
158 | #ifdef HAVE_SEMAPHORE_OBJECTS | 160 | #ifdef HAVE_SEMAPHORE_OBJECTS |
@@ -265,10 +267,17 @@ extern void mutex_init(struct mutex *m); | |||
265 | extern void mutex_lock(struct mutex *m); | 267 | extern void mutex_lock(struct mutex *m); |
266 | extern void mutex_unlock(struct mutex *m); | 268 | extern void mutex_unlock(struct mutex *m); |
267 | #ifdef HAVE_PRIORITY_SCHEDULING | 269 | #ifdef HAVE_PRIORITY_SCHEDULING |
268 | /* Temporary function to disable mutex preempting a thread on unlock */ | 270 | /* Deprecated temporary function to disable mutex preempting a thread on |
271 | * unlock - firmware/drivers/fat.c and a couple places in apps/buffering.c - | ||
272 | * reliance on it is a bug! */ | ||
269 | static inline void mutex_set_preempt(struct mutex *m, bool preempt) | 273 | static inline void mutex_set_preempt(struct mutex *m, bool preempt) |
270 | { m->no_preempt = !preempt; } | 274 | { m->no_preempt = !preempt; } |
271 | #endif | 275 | #else |
276 | /* Deprecated but needed for now - firmware/drivers/ata_mmc.c */ | ||
277 | static inline bool mutex_test(const struct mutex *m) | ||
278 | { return m->thread != NULL; } | ||
279 | #endif /* HAVE_PRIORITY_SCHEDULING */ | ||
280 | |||
272 | #ifdef HAVE_SEMAPHORE_OBJECTS | 281 | #ifdef HAVE_SEMAPHORE_OBJECTS |
273 | extern void semaphore_init(struct semaphore *s, int max, int start); | 282 | extern void semaphore_init(struct semaphore *s, int max, int start); |
274 | extern void semaphore_wait(struct semaphore *s); | 283 | extern void semaphore_wait(struct semaphore *s); |