kinetic-c  v0.12.0
Seagate Kinetic Protocol Client Library for C
Functions
kinetic_semaphore.h File Reference
#include <stdbool.h>

Go to the source code of this file.

Functions

KineticSemaphore * KineticSemaphore_Create (void)
 Creates a KineticSemaphore. More...
 
void KineticSemaphore_Signal (KineticSemaphore *sem)
 Signals KineticSemaphore. More...
 
bool KineticSemaphore_CheckSignaled (KineticSemaphore *sem)
 Reports whether the KineticSemaphore has been signaled. More...
 
bool KineticSemaphore_DestroyIfSignaled (KineticSemaphore *sem)
 Destorys the KineticSemaphore if it has been signaled. More...
 
void KineticSemaphore_WaitForSignalAndDestroy (KineticSemaphore *sem)
 Blocks until the given semaphore is signaled. More...
 

Function Documentation

KineticSemaphore* KineticSemaphore_Create ( void  )

Creates a KineticSemaphore.

The KineticSemaphore is a simple wrapper around a pthread condition variable and provides a a thread-safe way to block a thread and wait for notification from another thread.

Returns
Returns a pointer to a KineticSemaphore.

Definition at line 31 of file kinetic_semaphore.c.

void KineticSemaphore_Signal ( KineticSemaphore *  sem)

Signals KineticSemaphore.

This will unblock another thread that's blocked on the given semaphore using KineticSemaphore_WaitForSignalAndDestroy() You should never signal the same KineticSemaphore more than once.

Parameters
semA pointer to the semaphore to signal.

Definition at line 43 of file kinetic_semaphore.c.

bool KineticSemaphore_CheckSignaled ( KineticSemaphore *  sem)

Reports whether the KineticSemaphore has been signaled.

Parameters
semA pointer to the semaphore to report signaled status from.
Returns
Returns true if signaled.

Definition at line 51 of file kinetic_semaphore.c.

bool KineticSemaphore_DestroyIfSignaled ( KineticSemaphore *  sem)

Destorys the KineticSemaphore if it has been signaled.

Parameters
semA pointer to the semaphore to destroy.
Returns
Returns true signaled and detroyed. Returns false if not yet signaled.

Definition at line 56 of file kinetic_semaphore.c.

void KineticSemaphore_WaitForSignalAndDestroy ( KineticSemaphore *  sem)

Blocks until the given semaphore is signaled.

This will not block if the Semaphore has already been signaled. Once unblocked, this will also destroy (free) the provide KineticSemaphore.

Parameters
semA pointer to the semaphore to wait for a signal.

Definition at line 69 of file kinetic_semaphore.c.