Ignore:
File:
1 edited

Legend:

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

    rbc56f30 r4805495  
    4040#include <time.h>
    4141#include <stdbool.h>
    42 #include <_bits/decls.h>
    4342
    44 #ifndef __cplusplus
     43typedef struct {
     44        fibril_owner_info_t oi;  /**< Keep this the first thing. */
     45        int counter;
     46        list_t waiters;
     47} fibril_mutex_t;
    4548
    4649#define FIBRIL_MUTEX_INITIALIZER(name) \
     
    5558#define FIBRIL_MUTEX_INITIALIZE(name) \
    5659        fibril_mutex_t name = FIBRIL_MUTEX_INITIALIZER(name)
     60
     61typedef struct {
     62        fibril_owner_info_t oi;  /**< Keep this the first thing. */
     63        unsigned int writers;
     64        unsigned int readers;
     65        list_t waiters;
     66} fibril_rwlock_t;
    5767
    5868#define FIBRIL_RWLOCK_INITIALIZER(name) \
     
    6979        fibril_rwlock_t name = FIBRIL_RWLOCK_INITIALIZER(name)
    7080
     81typedef struct {
     82        list_t waiters;
     83} fibril_condvar_t;
     84
    7185#define FIBRIL_CONDVAR_INITIALIZER(name) \
    7286        { \
     
    7690#define FIBRIL_CONDVAR_INITIALIZE(name) \
    7791        fibril_condvar_t name = FIBRIL_CONDVAR_INITIALIZER(name)
    78 
    79 #define FIBRIL_SEMAPHORE_INITIALIZER(name, cnt) \
    80         { \
    81                 .count = (cnt), \
    82                 .waiters = LIST_INITIALIZER((name).waiters), \
    83         }
    84 
    85 #define FIBRIL_SEMAPHORE_INITIALIZE(name, cnt) \
    86         fibril_semaphore_t name = FIBRIL_SEMAPHORE_INITIALIZER(name, cnt)
    87 
    88 #endif
    89 
    90 __HELENOS_DECLS_BEGIN;
    91 
    92 typedef struct {
    93         fibril_owner_info_t oi;  /**< Keep this the first thing. */
    94         int counter;
    95         list_t waiters;
    96 } fibril_mutex_t;
    97 
    98 typedef struct {
    99         fibril_owner_info_t oi;  /**< Keep this the first thing. */
    100         unsigned int writers;
    101         unsigned int readers;
    102         list_t waiters;
    103 } fibril_rwlock_t;
    104 
    105 typedef struct {
    106         list_t waiters;
    107 } fibril_condvar_t;
    10892
    10993typedef void (*fibril_timer_fun_t)(void *);
     
    149133        bool closed;
    150134} fibril_semaphore_t;
     135
     136#define FIBRIL_SEMAPHORE_INITIALIZER(name, cnt) \
     137        { \
     138                .count = (cnt), \
     139                .waiters = LIST_INITIALIZER((name).waiters), \
     140        }
     141
     142#define FIBRIL_SEMAPHORE_INITIALIZE(name, cnt) \
     143        fibril_semaphore_t name = FIBRIL_SEMAPHORE_INITIALIZER(name, cnt)
    151144
    152145extern void __fibril_synch_init(void);
     
    197190extern void mpsc_close(mpsc_t *);
    198191
    199 __HELENOS_DECLS_END;
    200 
    201192#endif
    202193
Note: See TracChangeset for help on using the changeset viewer.