Program Listing for File csem.h

Return to documentation for file (rcsw/multithread/csem.h)

#pragma once

/*******************************************************************************
 * Includes
 ******************************************************************************/
#include <semaphore.h>

#include "rcsw/multithread/mutex.h"
#include "rcsw/rcsw.h"

/*******************************************************************************
 * Type Definitions
 ******************************************************************************/
struct csem {
  sem_t impl;

  uint32_t flags;
};

/*******************************************************************************
 * Function Prototypes
 ******************************************************************************/
BEGIN_C_DECLS

RCSW_API struct csem* csem_init(struct csem *sem_in,
                          size_t value,
                          uint32_t flags);

RCSW_API void csem_destroy(struct csem * sem);

RCSW_API status_t csem_post(struct csem * sem);

RCSW_API status_t csem_timedwait(struct csem * sem, const struct timespec * to);

RCSW_API status_t csem_wait(struct csem *sem);

RCSW_API status_t csem_trywait(struct csem *sem);

END_C_DECLS