Program Listing for File condv.h

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

#pragma once

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

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

/*******************************************************************************
 * Type Definitions
 ******************************************************************************/
struct condv {
  pthread_cond_t impl;

  uint32_t flags;
};

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

RCSW_API struct condv* condv_init(struct condv * cv_in, uint32_t flags);

RCSW_API void condv_destroy(struct condv *cv);

RCSW_API status_t condv_signal(struct condv * cv);

RCSW_API status_t condv_broadcast(struct condv * cv);

RCSW_API status_t condv_wait(struct condv * cv, struct mutex * mtx);

RCSW_API status_t condv_timedwait(struct condv* cv,
                        struct mutex* mtx,
                        const struct timespec * to);

END_C_DECLS