Loading...
Searching...
No Matches
pthread_cond.h File Reference

RIOT POSIX condition variable API. More...

Detailed Description

RIOT POSIX condition variable API.

Author
Martin Landsmann marti.nosp@m.n.la.nosp@m.ndsma.nosp@m.nn@h.nosp@m.aw-ha.nosp@m.mbur.nosp@m.g.de

Definition in file pthread_cond.h.

#include <time.h>
#include "mutex.h"
#include "priority_queue.h"
+ Include dependency graph for pthread_cond.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pthread_condattr_t
 
struct  pthread_cond_t
 Condition variable. More...
 
int pthread_cond_condattr_init (pthread_condattr_t *attr)
 Initializes a condition attribute variable object using default values.
 
int pthread_cond_condattr_destroy (pthread_condattr_t *attr)
 Uninitializes a condition attribute variable object.
 
int pthread_condattr_getpshared (const pthread_condattr_t *attr, int *pshared)
 Get the process-shared attribute in an initialized attributes object referenced by attr.
 
int pthread_condattr_setpshared (pthread_condattr_t *attr, int pshared)
 Set the process-shared attribute in an initialized attributes object referenced by attr.
 
int pthread_condattr_getclock (const pthread_condattr_t *attr, clockid_t *clock_id)
 Get the clock selected for the condition variable attribute attr.
 
int pthread_condattr_setclock (pthread_condattr_t *attr, clockid_t clock_id)
 Set the clock selected for the condition variable attribute ATTR.
 
int pthread_cond_init (pthread_cond_t *cond, pthread_condattr_t *attr)
 Initializes a condition variable object.
 
int pthread_cond_destroy (pthread_cond_t *cond)
 Destroy the condition variable cond.
 
int pthread_cond_wait (pthread_cond_t *cond, mutex_t *mutex)
 blocks the calling thread until the specified condition cond is signalled
 
int pthread_cond_timedwait (pthread_cond_t *cond, mutex_t *mutex, const struct timespec *abstime)
 blocks the calling thread until the specified condition cond is signalled
 
int pthread_cond_signal (pthread_cond_t *cond)
 unblock at least one of the threads that are blocked on the specified condition variable cond
 
int pthread_cond_broadcast (pthread_cond_t *cond)
 unblock all threads that are currently blocked on the specified condition variable cond
 

Function Documentation

◆ pthread_cond_broadcast()

int pthread_cond_broadcast ( pthread_cond_t cond)

unblock all threads that are currently blocked on the specified condition variable cond

Parameters
[in,out]condpre-allocated condition variable structure.
Returns
returns 0 on success, an errorcode otherwise.

◆ pthread_cond_condattr_destroy()

int pthread_cond_condattr_destroy ( pthread_condattr_t attr)

Uninitializes a condition attribute variable object.

Parameters
[in,out]attrpre-allocated condition attribute variable structure.
Returns
returns 0 on success, an errorcode otherwise.

◆ pthread_cond_condattr_init()

int pthread_cond_condattr_init ( pthread_condattr_t attr)

Initializes a condition attribute variable object using default values.

Parameters
[in,out]attrpre-allocated condition attribute variable structure.
Returns
returns 0 on success, an errorcode otherwise.

◆ pthread_cond_destroy()

int pthread_cond_destroy ( pthread_cond_t cond)

Destroy the condition variable cond.

Parameters
[in,out]condpre-allocated condition variable structure.
Returns
returns 0 on success, an errorcode otherwise.

◆ pthread_cond_init()

int pthread_cond_init ( pthread_cond_t cond,
pthread_condattr_t attr 
)

Initializes a condition variable object.

Parameters
[in,out]condpre-allocated condition variable structure.
[in]attrpre-allocated condition attribute variable structure.
Returns
returns 0 on success, an errorcode otherwise.

◆ pthread_cond_signal()

int pthread_cond_signal ( pthread_cond_t cond)

unblock at least one of the threads that are blocked on the specified condition variable cond

Parameters
[in,out]condpre-allocated condition variable structure.
Returns
returns 0 on success, an errorcode otherwise.

◆ pthread_cond_timedwait()

int pthread_cond_timedwait ( pthread_cond_t cond,
mutex_t mutex,
const struct timespec *  abstime 
)

blocks the calling thread until the specified condition cond is signalled

Parameters
[in,out]condpre-allocated condition variable structure.
[in,out]mutexpre-allocated mutex variable structure.
[in]abstimepre-allocated timeout.
Returns
returns 0 on success, an errorcode otherwise.

◆ pthread_cond_wait()

int pthread_cond_wait ( pthread_cond_t cond,
mutex_t mutex 
)

blocks the calling thread until the specified condition cond is signalled

Parameters
[in,out]condpre-allocated condition variable structure.
[in,out]mutexpre-allocated mutex variable structure.
Returns
returns 0 on success, an errorcode otherwise.

◆ pthread_condattr_getclock()

int pthread_condattr_getclock ( const pthread_condattr_t attr,
clockid_t *  clock_id 
)

Get the clock selected for the condition variable attribute attr.

Note
currently NOT USED in RIOT.
Parameters
[in]attrpre-allocated condition attribute variable structure.
[out]clock_idthe clock ID that is used to measure the timeout service
Returns
returns 0 on success, an errorcode otherwise.

◆ pthread_condattr_getpshared()

int pthread_condattr_getpshared ( const pthread_condattr_t attr,
int *  pshared 
)

Get the process-shared attribute in an initialized attributes object referenced by attr.

Note
NOT USED since RIOT is a single process OS
Parameters
[in]attrpre-allocated condition attribute variable structure.
[out]psharedthe pre-allocated process-shared variable.
Returns
returns 0 on success, an errorcode otherwise.

◆ pthread_condattr_setclock()

int pthread_condattr_setclock ( pthread_condattr_t attr,
clockid_t  clock_id 
)

Set the clock selected for the condition variable attribute ATTR.

Note
currently NOT USED in RIOT.
Parameters
[in,out]attrpre-allocated condition attribute variable structure.
[in]clock_idthe clock ID that shall be used to measure the timeout service
Returns
returns 0 on success, an errorcode otherwise.

◆ pthread_condattr_setpshared()

int pthread_condattr_setpshared ( pthread_condattr_t attr,
int  pshared 
)

Set the process-shared attribute in an initialized attributes object referenced by attr.

Note
NOT USED since RIOT is a single process OS
Parameters
[in,out]attrpre-allocated condition attribute variable structure.
[in]psharedpshared the pre-allocated process-shared variable.
Returns
returns 0 on success, an errorcode otherwise.