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

Changeset e9460aa in mainline


Ignore:
Timestamp:
2010-10-10T15:43:06Z (11 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master
Children:
e721462
Parents:
db6c332
Message:

Need a more flexible way to initialize fibril synchronization primitives.

File:
1 edited

Legend:

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

    rdb6c332 re9460aa  
    4747} fibril_mutex_t;
    4848
    49 #define FIBRIL_MUTEX_INITIALIZE(name) \
    50         fibril_mutex_t name = { \
     49#define FIBRIL_MUTEX_INITIALIZER(name) \
     50        { \
    5151                .counter = 1, \
    5252                .waiters = { \
     
    5555                } \
    5656        }
     57       
     58#define FIBRIL_MUTEX_INITIALIZE(name) \
     59        fibril_mutex_t name = FIBRIL_MUTEX_INITIALIZER(name)
    5760
    5861typedef struct {
     
    6265} fibril_rwlock_t;
    6366
    64 #define FIBRIL_RWLOCK_INITIALIZE(name) \
    65         fibril_rwlock_t name = { \
     67#define FIBRIL_RWLOCK_INITIALIZER(name) \
     68        { \
    6669                .readers = 0, \
    6770                .writers = 0, \
     
    7275        }
    7376
     77#define FIBRIL_RWLOCK_INITIALIZE(name) \
     78        fibril_rwlock_t name = FIBRIL_RWLOCK_INITIALIZER(name)
     79
    7480typedef struct {
    7581        link_t waiters;
    7682} fibril_condvar_t;
    7783
    78 #define FIBRIL_CONDVAR_INITIALIZE(name) \
    79         fibril_condvar_t name = { \
     84#define FIBRIL_CONDVAR_INITIALIZER(name) \
     85        { \
    8086                .waiters = { \
    8187                        .next = &name.waiters, \
     
    8389                } \
    8490        }
     91
     92#define FIBRIL_CONDVAR_INITIALIZE(name) \
     93        fibril_condvar_t name = FIBRIL_CONDVAR_INITIALIZER(name)
    8594
    8695extern void fibril_mutex_initialize(fibril_mutex_t *);
Note: See TracChangeset for help on using the changeset viewer.