QuickIO  0.2
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Typedefs | Functions
latch.h File Reference

Provides a latch that you can wait on. More...

#include "qev.h"

Go to the source code of this file.

Typedefs

typedef struct qev_latch qev_latch_t
 I've got everything to hide.
 

Functions

qev_latch_tqev_latch_new (gint count)
 Creates a new latch. More...
 
void qev_latch_free (qev_latch_t *latch)
 Clears a latch. More...
 
void qev_latch_dec (qev_latch_t *latch)
 Decrements the latch. More...
 
void qev_latch_await (qev_latch_t *latch)
 Waits for the latch. More...
 
gboolean qev_latch_await_time (qev_latch_t *latch, gint ms)
 Waits for the latch, or times out. More...
 
void qev_latch_reset (qev_latch_t *latch)
 Resets the latch. More...
 

Detailed Description

Provides a latch that you can wait on.

Author
Andrew Stone andre.nosp@m.w@cl.nosp@m.ovar..nosp@m.com

Function Documentation

void qev_latch_await ( qev_latch_t latch)

Waits for the latch.

Parameters
latchThe latch to decrement
gboolean qev_latch_await_time ( qev_latch_t latch,
gint  ms 
)

Waits for the latch, or times out.

Parameters
latchThe latch to decrement
msHow long to wait in milliseconds
Returns
TRUE if the latch was triggered; FALSE if timeout expired.
void qev_latch_dec ( qev_latch_t latch)

Decrements the latch.

Parameters
latchThe latch to decrement
void qev_latch_free ( qev_latch_t latch)

Clears a latch.

If any threads are waiting on the latch, they are immediately awoken and they will return.

Parameters
latchThe latch to clear
qev_latch_t* qev_latch_new ( gint  count)

Creates a new latch.

Parameters
countThe count to start the latch at
void qev_latch_reset ( qev_latch_t latch)

Resets the latch.

Anything waiting on the latch will start counting from the beginning.

Parameters
latchThe latch to reset