Changeset 89c57b6 in mainline for uspace/lib/c/include/fibril_synch.h


Ignore:
Timestamp:
2011-04-13T14:45:41Z (14 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
88634420
Parents:
cefb126 (diff), 17279ead (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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/include/fibril_synch.h

    rcefb126 r89c57b6  
    4343
    4444typedef struct {
     45        fibril_owner_info_t oi;         /* Keep this the first thing. */
    4546        int counter;
    4647        link_t waiters;
    4748} fibril_mutex_t;
    4849
    49 #define FIBRIL_MUTEX_INITIALIZE(name) \
    50         fibril_mutex_t name = { \
     50#define FIBRIL_MUTEX_INITIALIZER(name) \
     51        { \
     52                .oi = { \
     53                        .owned_by = NULL \
     54                }, \
    5155                .counter = 1, \
    5256                .waiters = { \
     
    5559                } \
    5660        }
     61       
     62#define FIBRIL_MUTEX_INITIALIZE(name) \
     63        fibril_mutex_t name = FIBRIL_MUTEX_INITIALIZER(name)
    5764
    5865typedef struct {
     66        fibril_owner_info_t oi; /* Keep this the first thing. */
    5967        unsigned writers;
    6068        unsigned readers;
     
    6270} fibril_rwlock_t;
    6371
    64 #define FIBRIL_RWLOCK_INITIALIZE(name) \
    65         fibril_rwlock_t name = { \
     72#define FIBRIL_RWLOCK_INITIALIZER(name) \
     73        { \
     74                .oi = { \
     75                        .owned_by = NULL \
     76                }, \
    6677                .readers = 0, \
    6778                .writers = 0, \
     
    7283        }
    7384
     85#define FIBRIL_RWLOCK_INITIALIZE(name) \
     86        fibril_rwlock_t name = FIBRIL_RWLOCK_INITIALIZER(name)
     87
    7488typedef struct {
    7589        link_t waiters;
    7690} fibril_condvar_t;
    7791
    78 #define FIBRIL_CONDVAR_INITIALIZE(name) \
    79         fibril_condvar_t name = { \
     92#define FIBRIL_CONDVAR_INITIALIZER(name) \
     93        { \
    8094                .waiters = { \
    8195                        .next = &name.waiters, \
     
    8498        }
    8599
     100#define FIBRIL_CONDVAR_INITIALIZE(name) \
     101        fibril_condvar_t name = FIBRIL_CONDVAR_INITIALIZER(name)
     102
    86103extern void fibril_mutex_initialize(fibril_mutex_t *);
    87104extern void fibril_mutex_lock(fibril_mutex_t *);
    88105extern bool fibril_mutex_trylock(fibril_mutex_t *);
    89106extern void fibril_mutex_unlock(fibril_mutex_t *);
     107extern bool fibril_mutex_is_locked(fibril_mutex_t *);
    90108
    91109extern void fibril_rwlock_initialize(fibril_rwlock_t *);
     
    94112extern void fibril_rwlock_read_unlock(fibril_rwlock_t *);
    95113extern void fibril_rwlock_write_unlock(fibril_rwlock_t *);
     114extern bool fibril_rwlock_is_read_locked(fibril_rwlock_t *);
     115extern bool fibril_rwlock_is_write_locked(fibril_rwlock_t *);
     116extern bool fibril_rwlock_is_locked(fibril_rwlock_t *);
    96117
    97118extern void fibril_condvar_initialize(fibril_condvar_t *);
Note: See TracChangeset for help on using the changeset viewer.