Program Listing for File rdwrlock.h
↰ Return to documentation for file (rcsw/multithread/rdwrlock.h
)
#pragma once
/*******************************************************************************
* Includes
******************************************************************************/
#include "rcsw/multithread/csem.h"
#include "rcsw/rcsw.h"
/*******************************************************************************
* Type Definitions
******************************************************************************/
struct rdwrlock {
struct csem order;
struct csem access;
struct csem read;
size_t n_readers;
uint32_t flags;
};
enum rdwrlock_scope {
ekSCOPE_RD,
ekSCOPE_WR,
};
/*******************************************************************************
* API Functions
******************************************************************************/
BEGIN_C_DECLS
RCSW_API struct rdwrlock* rdwrl_init(struct rdwrlock *const rdwr_in,
uint32_t flags) RCSW_WUR;
RCSW_API void rdwrl_destroy(struct rdwrlock *const rdwr);
RCSW_API void rdwrl_req(struct rdwrlock *const rdwr, enum rdwrlock_scope scope);
RCSW_API void rdwrl_exit(struct rdwrlock *const rdwr,
enum rdwrlock_scope scope);
RCSW_API status_t rdwrl_timedreq(struct rdwrlock *const rdwr,
enum rdwrlock_scope scope,
const struct timespec *const to);
END_C_DECLS