Changeset c47e1a8 in mainline for kernel/generic/src/synch/mutex.c
- Timestamp:
- 2010-05-21T07:50:04Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- d51ee2b
- Parents:
- cf8cc36 (diff), 15b592b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/synch/mutex.c
rcf8cc36 rc47e1a8 33 33 /** 34 34 * @file 35 * @brief 35 * @brief Mutexes. 36 36 */ 37 37 38 38 #include <synch/mutex.h> 39 39 #include <synch/semaphore.h> 40 40 #include <synch/synch.h> 41 41 #include <debug.h> 42 #include <arch.h> 42 43 43 44 /** Initialize mutex. 44 45 * 45 * @param mtx 46 * @param type 46 * @param mtx Mutex. 47 * @param type Type of the mutex. 47 48 */ 48 49 void mutex_initialize(mutex_t *mtx, mutex_type_t type) … … 56 57 * Timeout mode and non-blocking mode can be requested. 57 58 * 58 * @param mtx 59 * @param usec 60 * @param flags 59 * @param mtx Mutex. 60 * @param usec Timeout in microseconds. 61 * @param flags Specify mode of operation. 61 62 * 62 63 * For exact description of possible combinations of 63 64 * usec and flags, see comment for waitq_sleep_timeout(). 64 65 * 65 * @return See comment for waitq_sleep_timeout(). 66 * @return See comment for waitq_sleep_timeout(). 67 * 66 68 */ 67 69 int _mutex_lock_timeout(mutex_t *mtx, uint32_t usec, int flags) … … 69 71 int rc; 70 72 71 if ( mtx->type == MUTEX_PASSIVE) {73 if ((mtx->type == MUTEX_PASSIVE) && (THREAD)) { 72 74 rc = _semaphore_down_timeout(&mtx->sem, usec, flags); 73 75 } else { 74 ASSERT( mtx->type == MUTEX_ACTIVE);76 ASSERT((mtx->type == MUTEX_ACTIVE) || (!THREAD)); 75 77 ASSERT(usec == SYNCH_NO_TIMEOUT); 76 78 ASSERT(!(flags & SYNCH_FLAGS_INTERRUPTIBLE)); 79 77 80 do { 78 81 rc = semaphore_trydown(&mtx->sem); … … 86 89 /** Release mutex. 87 90 * 88 * @param mtx 91 * @param mtx Mutex. 89 92 */ 90 93 void mutex_unlock(mutex_t *mtx)
Note:
See TracChangeset
for help on using the changeset viewer.