Program Listing for File cvm.h

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

#pragma once

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

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

/*******************************************************************************
 * Type Definitions
 ******************************************************************************/
struct cvm {
  struct mutex mtx;
  struct condv cv;

  uint32_t flags;
};

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

RCSW_API struct cvm* cvm_init(struct cvm * cvm_in, uint32_t flags);

RCSW_API void mt_cvm_destroy(struct cvm * cvm);

RCSW_API status_t cvm_signal(struct cvm * cvm);

RCSW_API status_t cvm_broadcast(struct cvm * cvm);

RCSW_API status_t cvm_wait(struct cvm * cvm);

RCSW_API status_t cvm_timedwait(struct cvm * cvm, const struct timespec * to);

END_C_DECLS