Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset d7da4284 in mainline


Ignore:
Timestamp:
2010-05-25T21:34:41Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
ffe4a87
Parents:
5df7928
Message:

Add interface for testing the state of a mutex.

Location:
kernel/generic
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/synch/mutex.h

    r5df7928 rd7da4284  
    6060
    6161extern void mutex_initialize(mutex_t *, mutex_type_t);
     62extern bool mutex_locked(mutex_t *);
    6263extern int _mutex_lock_timeout(mutex_t *, uint32_t, unsigned int);
    6364extern void mutex_unlock(mutex_t *);
  • kernel/generic/src/synch/mutex.c

    r5df7928 rd7da4284  
    5353}
    5454
     55/** Find out whether the mutex is currently locked.
     56 *
     57 * @param mtx           Mutex.
     58 * @return              True if the mutex is locked, false otherwise.
     59 */
     60bool mutex_locked(mutex_t *mtx)
     61{
     62        return semaphore_count_get(&mtx->sem) <= 0;
     63}
     64
    5565/** Acquire mutex.
    5666 *
Note: See TracChangeset for help on using the changeset viewer.