diff options
author | Bertrik Sikken <bertrik@sikken.nl> | 2010-04-18 15:24:39 +0000 |
---|---|---|
committer | Bertrik Sikken <bertrik@sikken.nl> | 2010-04-18 15:24:39 +0000 |
commit | c493a1e39d4ce5c725bad9cb3686ee3e8477f734 (patch) | |
tree | 9cd4ffb2df2fedafa365a7a8d930a67cf98adefe /firmware/kernel.c | |
parent | 44454c3203c84930c3e46d593c44e1edd6d56cc8 (diff) | |
download | rockbox-c493a1e39d4ce5c725bad9cb3686ee3e8477f734.tar.gz rockbox-c493a1e39d4ce5c725bad9cb3686ee3e8477f734.zip |
Use boolean instead of int for keeping track of mutex signalled state and wakeup signalled state
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25671 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/kernel.c')
-rw-r--r-- | firmware/kernel.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/firmware/kernel.c b/firmware/kernel.c index d7076c935f..64c8142540 100644 --- a/firmware/kernel.c +++ b/firmware/kernel.c | |||
@@ -892,7 +892,7 @@ void mutex_init(struct mutex *m) | |||
892 | corelock_init(&m->cl); | 892 | corelock_init(&m->cl); |
893 | m->queue = NULL; | 893 | m->queue = NULL; |
894 | m->count = 0; | 894 | m->count = 0; |
895 | m->locked = 0; | 895 | m->locked = false; |
896 | mutex_set_thread(m, NULL); | 896 | mutex_set_thread(m, NULL); |
897 | #ifdef HAVE_PRIORITY_SCHEDULING | 897 | #ifdef HAVE_PRIORITY_SCHEDULING |
898 | m->blocker.priority = PRIORITY_IDLE; | 898 | m->blocker.priority = PRIORITY_IDLE; |
@@ -916,11 +916,11 @@ void mutex_lock(struct mutex *m) | |||
916 | /* lock out other cores */ | 916 | /* lock out other cores */ |
917 | corelock_lock(&m->cl); | 917 | corelock_lock(&m->cl); |
918 | 918 | ||
919 | if(LIKELY(m->locked == 0)) | 919 | if(LIKELY(!m->locked)) |
920 | { | 920 | { |
921 | /* lock is open */ | 921 | /* lock is open */ |
922 | mutex_set_thread(m, current); | 922 | mutex_set_thread(m, current); |
923 | m->locked = 1; | 923 | m->locked = true; |
924 | corelock_unlock(&m->cl); | 924 | corelock_unlock(&m->cl); |
925 | return; | 925 | return; |
926 | } | 926 | } |
@@ -963,7 +963,7 @@ void mutex_unlock(struct mutex *m) | |||
963 | { | 963 | { |
964 | /* no threads waiting - open the lock */ | 964 | /* no threads waiting - open the lock */ |
965 | mutex_set_thread(m, NULL); | 965 | mutex_set_thread(m, NULL); |
966 | m->locked = 0; | 966 | m->locked = false; |
967 | corelock_unlock(&m->cl); | 967 | corelock_unlock(&m->cl); |
968 | return; | 968 | return; |
969 | } | 969 | } |
@@ -1062,7 +1062,7 @@ void semaphore_release(struct semaphore *s) | |||
1062 | void wakeup_init(struct wakeup *w) | 1062 | void wakeup_init(struct wakeup *w) |
1063 | { | 1063 | { |
1064 | w->queue = NULL; | 1064 | w->queue = NULL; |
1065 | w->signalled = 0; | 1065 | w->signalled = false; |
1066 | IF_COP( corelock_init(&w->cl); ) | 1066 | IF_COP( corelock_init(&w->cl); ) |
1067 | } | 1067 | } |
1068 | 1068 | ||
@@ -1074,7 +1074,7 @@ int wakeup_wait(struct wakeup *w, int timeout) | |||
1074 | 1074 | ||
1075 | corelock_lock(&w->cl); | 1075 | corelock_lock(&w->cl); |
1076 | 1076 | ||
1077 | if(LIKELY(w->signalled == 0 && timeout != TIMEOUT_NOBLOCK)) | 1077 | if(LIKELY(!w->signalled && timeout != TIMEOUT_NOBLOCK)) |
1078 | { | 1078 | { |
1079 | struct thread_entry * current = thread_id_entry(THREAD_ID_CURRENT); | 1079 | struct thread_entry * current = thread_id_entry(THREAD_ID_CURRENT); |
1080 | 1080 | ||
@@ -1093,14 +1093,14 @@ int wakeup_wait(struct wakeup *w, int timeout) | |||
1093 | corelock_lock(&w->cl); | 1093 | corelock_lock(&w->cl); |
1094 | } | 1094 | } |
1095 | 1095 | ||
1096 | if(UNLIKELY(w->signalled == 0)) | 1096 | if(UNLIKELY(!w->signalled)) |
1097 | { | 1097 | { |
1098 | /* Timed-out or failed */ | 1098 | /* Timed-out or failed */ |
1099 | ret = (timeout != TIMEOUT_BLOCK) ? | 1099 | ret = (timeout != TIMEOUT_BLOCK) ? |
1100 | OBJ_WAIT_TIMEDOUT : OBJ_WAIT_FAILED; | 1100 | OBJ_WAIT_TIMEDOUT : OBJ_WAIT_FAILED; |
1101 | } | 1101 | } |
1102 | 1102 | ||
1103 | w->signalled = 0; /* Reset */ | 1103 | w->signalled = false; /* Reset */ |
1104 | 1104 | ||
1105 | corelock_unlock(&w->cl); | 1105 | corelock_unlock(&w->cl); |
1106 | restore_irq(oldlevel); | 1106 | restore_irq(oldlevel); |
@@ -1120,7 +1120,7 @@ int wakeup_signal(struct wakeup *w) | |||
1120 | 1120 | ||
1121 | corelock_lock(&w->cl); | 1121 | corelock_lock(&w->cl); |
1122 | 1122 | ||
1123 | w->signalled = 1; | 1123 | w->signalled = true; |
1124 | ret = wakeup_thread(&w->queue); | 1124 | ret = wakeup_thread(&w->queue); |
1125 | 1125 | ||
1126 | corelock_unlock(&w->cl); | 1126 | corelock_unlock(&w->cl); |