Program Listing for File bsem.h
↰ Return to documentation for file (rcsw/multithread/bsem.h
)
#pragma once
/*******************************************************************************
* Includes
******************************************************************************/
#include <time.h>
#include "rcsw/rcsw.h"
#include "rcsw/multithread/condv.h"
#include "rcsw/multithread/mutex.h"
/*******************************************************************************
* Type Definitions
******************************************************************************/
struct bsem {
struct mutex mtx;
struct condv cv;
bool_t val;
uint32_t flags;
};
/*******************************************************************************
* Function Prototypes
******************************************************************************/
BEGIN_C_DECLS
RCSW_API struct bsem* bsem_init(struct bsem * sem_in, uint32_t flags);
RCSW_API void bsem_destroy(struct bsem * sem);
RCSW_API status_t bsem_post(struct bsem * sem);
RCSW_API status_t bsem_flush(struct bsem * sem);
RCSW_API status_t bsem_timedwait(struct bsem * sem,
const struct timespec * to);
RCSW_API status_t bsem_wait(struct bsem * sem);
END_C_DECLS