Ignore:
File:
1 edited

Legend:

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

    r9f2f5ee re88eb48  
    4444        MUTEX_PASSIVE,
    4545        MUTEX_RECURSIVE,
     46        MUTEX_ACTIVE
    4647} mutex_type_t;
    4748
     
    5051typedef struct {
    5152        mutex_type_t type;
    52         int nesting;
    5353        semaphore_t sem;
    54         _Atomic(struct thread *) owner;
     54        struct thread *owner;
     55        unsigned nesting;
    5556} mutex_t;
    5657
    57 #define MUTEX_INITIALIZER(name, mtype) (mutex_t) { \
    58         .type = (mtype), \
    59         .nesting = 0, \
    60         .sem = SEMAPHORE_INITIALIZER((name).sem, 1), \
    61         .owner = NULL, \
    62 }
     58#define mutex_lock(mtx) \
     59        _mutex_lock_timeout((mtx), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NONE)
    6360
    64 #define MUTEX_INITIALIZE(name, mtype) \
    65         mutex_t name = MUTEX_INITIALIZER(name, mtype)
     61#define mutex_trylock(mtx) \
     62        _mutex_lock_timeout((mtx), SYNCH_NO_TIMEOUT, SYNCH_FLAGS_NON_BLOCKING)
     63
     64#define mutex_lock_timeout(mtx, usec) \
     65        _mutex_lock_timeout((mtx), (usec), SYNCH_FLAGS_NON_BLOCKING)
    6666
    6767extern void mutex_initialize(mutex_t *, mutex_type_t);
    6868extern bool mutex_locked(mutex_t *);
    69 extern errno_t mutex_trylock(mutex_t *);
    70 extern void mutex_lock(mutex_t *);
    71 extern errno_t mutex_lock_timeout(mutex_t *, uint32_t);
     69extern errno_t _mutex_lock_timeout(mutex_t *, uint32_t, unsigned int);
    7270extern void mutex_unlock(mutex_t *);
    7371
Note: See TracChangeset for help on using the changeset viewer.