Changeset 52acfab in mainline for uspace/lib/c/include/fibril_synch.h


Ignore:
Timestamp:
2019-05-28T19:24:14Z (5 years ago)
Author:
GitHub <noreply@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
77de449e
Parents:
af5037d (diff), bebd154 (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.
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2019-05-28 19:24:14)
git-committer:
GitHub <noreply@…> (2019-05-28 19:24:14)
Message:

Merge pull request #161 from le-jzr/cxxcompat2

C++ compatibility improvements

File:
1 edited

Legend:

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

    raf5037d r52acfab  
    4040#include <time.h>
    4141#include <stdbool.h>
    42 
    43 typedef struct {
    44         fibril_owner_info_t oi;  /**< Keep this the first thing. */
    45         int counter;
    46         list_t waiters;
    47 } fibril_mutex_t;
     42#include <_bits/decls.h>
     43
     44#ifndef __cplusplus
    4845
    4946#define FIBRIL_MUTEX_INITIALIZER(name) \
     
    5855#define FIBRIL_MUTEX_INITIALIZE(name) \
    5956        fibril_mutex_t name = FIBRIL_MUTEX_INITIALIZER(name)
    60 
    61 typedef 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;
    6757
    6858#define FIBRIL_RWLOCK_INITIALIZER(name) \
     
    7969        fibril_rwlock_t name = FIBRIL_RWLOCK_INITIALIZER(name)
    8070
    81 typedef struct {
    82         list_t waiters;
    83 } fibril_condvar_t;
    84 
    8571#define FIBRIL_CONDVAR_INITIALIZER(name) \
    8672        { \
     
    9076#define FIBRIL_CONDVAR_INITIALIZE(name) \
    9177        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
     92typedef struct {
     93        fibril_owner_info_t oi;  /**< Keep this the first thing. */
     94        int counter;
     95        list_t waiters;
     96} fibril_mutex_t;
     97
     98typedef 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
     105typedef struct {
     106        list_t waiters;
     107} fibril_condvar_t;
    92108
    93109typedef void (*fibril_timer_fun_t)(void *);
     
    134150} fibril_semaphore_t;
    135151
    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)
    144 
    145152extern void __fibril_synch_init(void);
    146153extern void __fibril_synch_fini(void);
     
    190197extern void mpsc_close(mpsc_t *);
    191198
     199__HELENOS_DECLS_END;
     200
    192201#endif
    193202
Note: See TracChangeset for help on using the changeset viewer.