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.
SyncData Struct Reference

A datatype that allows data to be shared between tasks (e.g. More...

#include <linux_sync_data.h>

Public Member Functions

struct SyncDataAllocateSyncData (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...
 

Detailed Description

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.

Member Function Documentation

◆ AllocateSyncData()

struct SyncData * AllocateSyncData ( void  )

Allocate a SyncData.

Returns
The newly-allocated SyncData or NULL upon error.

◆ FreeSyncData()

void FreeSyncData ( struct SyncData sync_data_p)

Free a SyncData.

Parameters
sync_data_pThe SyncData to free.

◆ AcquireSyncDataLock()

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

Parameters
sync_data_pThe SyncData to lock.
Returns
true if the lock was acquired successfully, false otherwise.

◆ ReleaseSyncDataLock()

bool ReleaseSyncDataLock ( struct SyncData sync_data_p)

Release the lock non a given SyncData.

Parameters
sync_data_pThe SyncData to release the lock for.
Returns
true if the lock was released successfully, false otherwise.

◆ WaitOnSyncData()

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.

Parameters
sync_data_pThe SyncData to wait.
continue_fnThe 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_pThe parameter to use as input for continue_fn if needed.

◆ SendSyncData()

void SendSyncData ( struct SyncData sync_data_p)

Signal that a condition has been met.

Parameters
sync_data_pThe SyncData to send the signal from.

The documentation for this struct was generated from the following files: