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 for an AsyncTask that has a counter that sends a signal when that counter reaches a given limit. More...
#include <count_async_task.h>
Public Member Functions | |
CountAsyncTask * | AllocateCountAsyncTask (const char *name_s, struct AsyncTasksManager *manager_p, bool add_flag, int32 limit) |
Allocate a CountAsyncTask. More... | |
bool | InitCountAsyncTask (CountAsyncTask *count_task_p, const char *name_s, struct AsyncTasksManager *manager_p, bool add_flag, int32 limit) |
Initialise a CountAsyncTask. More... | |
AsyncTask * | GetAsyncTaskFromCountAsyncTask (CountAsyncTask *count_task_p) |
Get the underlying AsyncTask for a given CountAsyncTask. More... | |
void | FreeCountAsyncTask (CountAsyncTask *count_task_p) |
Free a CountAsyncTask. More... | |
void | ClearCountAsyncTask (CountAsyncTask *count_task_p) |
Remove and free the underlying AsyncTask from a given CountAsyncTask. More... | |
bool | IncrementCountAsyncTask (CountAsyncTask *count_task_p) |
Increment the counter for a given CountAsyncTask. More... | |
bool | ContinueCountAsyncTask (const CountAsyncTask *count_task_p) |
The default callback function to check whether a CountAsyncTask could continue running. More... | |
void | SetCountAsyncTaskLimit (CountAsyncTask *task_p, int32 limit) |
Set the limit for a given CountAsyncTask. More... | |
Data Fields | |
AsyncTask * | cat_task_p |
The underlying AsyncTask. More... | |
int32 | cat_current_value |
The current value of the counter for this CountAsyncTask. More... | |
int32 | cat_limit |
The value at which this CountAsyncTask will send the message saying that it has completed. More... | |
A datatype for an AsyncTask that has a counter that sends a signal when that counter reaches a given limit.
This is used when you are running a set number of jobs and you are waiting for a certain number of them to complete.
CountAsyncTask * AllocateCountAsyncTask | ( | const char * | name_s, |
struct AsyncTasksManager * | manager_p, | ||
bool | add_flag, | ||
int32 | limit | ||
) |
Allocate a CountAsyncTask.
name_s | The name to give to this CountAsyncTask. This value will be deep-copied. |
manager_p | The AsyncTasksManager that will own this AsyncTask. |
add_flag | If this is true then the newly-allocated CountAsyncTask will be added to the given AsyncTasksManager's list of AsyncTasks, false otherwise. |
limit | The limit at which this CountAsyncTask will signal its completion. |
NULL
upon error. bool InitCountAsyncTask | ( | CountAsyncTask * | count_task_p, |
const char * | name_s, | ||
struct AsyncTasksManager * | manager_p, | ||
bool | add_flag, | ||
int32 | limit | ||
) |
Initialise a CountAsyncTask.
count_task_p | The CountAsyncTask to initialise. |
name_s | The name to give to this CountAsyncTask. This value will be deep-copied. |
manager_p | The AsyncTasksManager that will own this AsyncTask. |
add_flag | If this is true then the newly-allocated CountAsyncTask will be added to the given AsyncTasksManager's list of AsyncTasks, false otherwise. |
limit | The limit at which this CountAsyncTask will signal its completion. |
true
if the CountAsyncTask was initialised successfully, false
otherwise. AsyncTask * GetAsyncTaskFromCountAsyncTask | ( | CountAsyncTask * | count_task_p | ) |
Get the underlying AsyncTask for a given CountAsyncTask.
count_task_p | The CountAsyncTask to get the AsyncTask for. |
void FreeCountAsyncTask | ( | CountAsyncTask * | count_task_p | ) |
Free a CountAsyncTask.
count_task_p | The CountAsyncTask to free. |
void ClearCountAsyncTask | ( | CountAsyncTask * | count_task_p | ) |
Remove and free the underlying AsyncTask from a given CountAsyncTask.
count_task_p | The CountAsyncTask to alter. |
bool IncrementCountAsyncTask | ( | CountAsyncTask * | count_task_p | ) |
Increment the counter for a given CountAsyncTask.
If the CountAsyncTask reaches its limit, it will call SendSyncData for its underlying AsyncTask to notify any EventConsumers that it has completed
count_task_p | The CountAsyncTask to increment. |
true
if the CountAsyncTask was incremented successfully, false
otherwise. bool ContinueCountAsyncTask | ( | const CountAsyncTask * | count_task_p | ) |
The default callback function to check whether a CountAsyncTask could continue running.
count_task_p | The CountAsyncTask to check. |
true
if the CountAsyncTask's counter has reached the CountAsyncTask's limit, false
otherwise. void SetCountAsyncTaskLimit | ( | CountAsyncTask * | task_p, |
int32 | limit | ||
) |
Set the limit for a given CountAsyncTask.
task_p | The CountAsyncTask to set the limit for. |
limit | The new limit. |
int32 cat_current_value |
The current value of the counter for this CountAsyncTask.
int32 cat_limit |
The value at which this CountAsyncTask will send the message saying that it has completed.