YAZ  5.34.0
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

◆ yaz_cond_broadcast()

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.

◆ yaz_cond_create()

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().

◆ yaz_cond_destroy()

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().

◆ yaz_cond_signal()

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.

◆ yaz_cond_wait()

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().