Changeset c47e1a8 in mainline for kernel/generic/src/synch/mutex.c


Ignore:
Timestamp:
2010-05-21T07:50:04Z (15 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
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.
Message:

merge mainline changes (rev. 451)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/synch/mutex.c

    rcf8cc36 rc47e1a8  
    3333/**
    3434 * @file
    35  * @brief       Mutexes.
     35 * @brief Mutexes.
    3636 */
    37  
     37
    3838#include <synch/mutex.h>
    3939#include <synch/semaphore.h>
    4040#include <synch/synch.h>
    4141#include <debug.h>
     42#include <arch.h>
    4243
    4344/** Initialize mutex.
    4445 *
    45  * @param mtx           Mutex.
    46  * @param type          Type of the mutex.
     46 * @param mtx  Mutex.
     47 * @param type Type of the mutex.
    4748 */
    4849void mutex_initialize(mutex_t *mtx, mutex_type_t type)
     
    5657 * Timeout mode and non-blocking mode can be requested.
    5758 *
    58  * @param mtx           Mutex.
    59  * @param usec          Timeout in microseconds.
    60  * @param flags         Specify mode of operation.
     59 * @param mtx   Mutex.
     60 * @param usec  Timeout in microseconds.
     61 * @param flags Specify mode of operation.
    6162 *
    6263 * For exact description of possible combinations of
    6364 * usec and flags, see comment for waitq_sleep_timeout().
    6465 *
    65  * @return              See comment for waitq_sleep_timeout().
     66 * @return See comment for waitq_sleep_timeout().
     67 *
    6668 */
    6769int _mutex_lock_timeout(mutex_t *mtx, uint32_t usec, int flags)
     
    6971        int rc;
    7072
    71         if (mtx->type == MUTEX_PASSIVE) {
     73        if ((mtx->type == MUTEX_PASSIVE) && (THREAD)) {
    7274                rc = _semaphore_down_timeout(&mtx->sem, usec, flags);
    7375        } else {
    74                 ASSERT(mtx->type == MUTEX_ACTIVE);
     76                ASSERT((mtx->type == MUTEX_ACTIVE) || (!THREAD));
    7577                ASSERT(usec == SYNCH_NO_TIMEOUT);
    7678                ASSERT(!(flags & SYNCH_FLAGS_INTERRUPTIBLE));
     79               
    7780                do {
    7881                        rc = semaphore_trydown(&mtx->sem);
     
    8689/** Release mutex.
    8790 *
    88  * @param mtx           Mutex.
     91 * @param mtx Mutex.
    8992 */
    9093void mutex_unlock(mutex_t *mtx)
Note: See TracChangeset for help on using the changeset viewer.