YAZ  5.23.1
Data Structures | Functions
condvar.c File Reference

Wraps condition variables. More...

#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <stddef.h>
#include <yaz/xmalloc.h>
#include <yaz/nmem.h>
#include <yaz/log.h>
#include <yaz/mutex.h>
#include <yaz/gettimeofday.h>
#include <time.h>
#include "mutex-p.h"

Go to the source code of this file.

Data Structures

struct  yaz_cond
 

Functions

void yaz_cond_create (YAZ_COND *p)
 creates condition variable More...
 
void yaz_cond_destroy (YAZ_COND *p)
 destroys condition variable More...
 
int yaz_cond_wait (YAZ_COND p, YAZ_MUTEX m, const struct timeval *abstime)
 waits for condition More...
 
int yaz_cond_signal (YAZ_COND p)
 unblock one thread waiting for block More...
 
int yaz_cond_broadcast (YAZ_COND p)
 unblock all threads waiting for block More...
 

Detailed Description

Wraps condition variables.

Definition in file condvar.c.

Function Documentation

int yaz_cond_broadcast ( YAZ_COND  p)

unblock all threads waiting for block

Parameters
pcondition variable handle

Definition at line 120 of file condvar.c.

void yaz_cond_create ( YAZ_COND p)

creates condition variable

Parameters
preference to condition handle

Upon successful completion *p holds the condition handle; *p = 0 on error.

Definition at line 49 of file condvar.c.

References malloc().

void yaz_cond_destroy ( YAZ_COND p)

destroys condition variable

Parameters
preference to condition handle

Upon completion *p holds 0.

Definition at line 62 of file condvar.c.

References free().

int yaz_cond_signal ( YAZ_COND  p)

unblock one thread waiting for block

Parameters
pcondition variable handle

Definition at line 108 of file condvar.c.

int yaz_cond_wait ( YAZ_COND  p,
YAZ_MUTEX  m,
const struct timeval *  abstime 
)

waits for condition

Parameters
pcondition variable handle
mmutex
abstimewait until this time; 0 for indefinite wait

Semantics like pthread_cond_wait.

Definition at line 75 of file condvar.c.

References yaz_gettimeofday().