Grassroots Infrastructure
The Grassroots Infrastructure is a suite of computing tools to help users and developers use scientific data infrastructure that can easily be interconnected.
|
A datatype that allows data to be shared between tasks (e.g. More...
#include <linux_sync_data.h>
Public Member Functions | |
struct SyncData * | AllocateSyncData (void) |
Allocate a SyncData. More... | |
void | FreeSyncData (struct SyncData *sync_data_p) |
Free a SyncData. More... | |
bool | AcquireSyncDataLock (struct SyncData *sync_data_p) |
Lock a SyncData to allow for thread-safe access. More... | |
bool | ReleaseSyncDataLock (struct SyncData *sync_data_p) |
Release the lock non a given SyncData. More... | |
void | WaitOnSyncData (struct SyncData *sync_data_p, bool(*continue_fn)(void *data_p), void *data_p) |
Wait for a SyncData condition to be met using a given function to check for the condition. More... | |
void | SendSyncData (struct SyncData *sync_data_p) |
Signal that a condition has been met. More... | |
A datatype that allows data to be shared between tasks (e.g.
threads) in a platform-agnsotic way. It allows to you lock some data so you may access it in a thread-safe manner.
struct SyncData * AllocateSyncData | ( | void | ) |
void FreeSyncData | ( | struct SyncData * | sync_data_p | ) |
bool AcquireSyncDataLock | ( | struct SyncData * | sync_data_p | ) |
Lock a SyncData to allow for thread-safe access.
After you have finished accessing the SyncData, you must release it using ReleaseSyncDataLock().
sync_data_p | The SyncData to lock. |
true
if the lock was acquired successfully, false
otherwise. bool ReleaseSyncDataLock | ( | struct SyncData * | sync_data_p | ) |
void WaitOnSyncData | ( | struct SyncData * | sync_data_p, |
bool(*)(void *data_p) | continue_fn, | ||
void * | data_p | ||
) |
Wait for a SyncData condition to be met using a given function to check for the condition.
sync_data_p | The SyncData to wait. |
continue_fn | The function used to check whether the condition has been met. This will return true when the condition has not been met yet and the waiting should continue. This function will be called with the custom parameter data_p |
data_p | The parameter to use as input for continue_fn if needed. |
void SendSyncData | ( | struct SyncData * | sync_data_p | ) |
Signal that a condition has been met.
sync_data_p | The SyncData to send the signal from. |