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

A datatype to allow the running of command-line applications in a separate task. More...

#include <system_async_task.h>

Collaboration diagram for SystemAsyncTask:
[legend]

Public Member Functions

SystemAsyncTaskAllocateSystemAsyncTask (ServiceJob *job_p, const char *name_s, struct AsyncTasksManager *manager_p, bool add_flag, const char *command_s, void(*on_success_callback_fn)(ServiceJob *job_p))
 Allocate a SystemAsyncTask. More...
 
bool SetSystemAsyncTaskCommand (SystemAsyncTask *task_p, const char *command_s)
 Set the command line for a SystemAsyncTask to run. More...
 
void FreeSystemAsyncTask (SystemAsyncTask *task_p)
 Free a SystemAsyncTask. More...
 
bool RunSystemAsyncTask (SystemAsyncTask *task_p)
 Run a SystemAsyncTask. More...
 

Data Fields

AsyncTaskstd_async_task_p
 The underlying AsyncTask. More...
 
MEM_FLAG std_async_task_mem
 The MEM_FLAG determining whether the AsyncTask pointed to by std_async_task_p will be deleted when this SystemAsyncTask is freed. More...
 
ServiceJobstd_service_job_p
 The ServiceJob that will run this SystemAsyncTask. More...
 
char * std_command_line_s
 The command line that this SystemAsyncTask will run. More...
 
void(* std_on_success_callback_fn )(ServiceJob *job_p)
 The callback function that this SystemAsyncTask will call if it runs successfully. More...
 

Detailed Description

A datatype to allow the running of command-line applications in a separate task.

Member Function Documentation

◆ AllocateSystemAsyncTask()

SystemAsyncTask * AllocateSystemAsyncTask ( ServiceJob job_p,
const char *  name_s,
struct AsyncTasksManager manager_p,
bool  add_flag,
const char *  command_s,
void(*)(ServiceJob *job_p)  on_success_callback_fn 
)

Allocate a SystemAsyncTask.

Parameters
job_pThe ServiceJob that will run this SystemAsyncTask.
name_sThe name to give to the underlying AsyncTask. The SystemAsyncTask will make a deep copy of this value.
manager_pThe AsyncTasksManager for this AsyncTask.
add_flagIf this is true then this SystemAsyncTask will be added to the AsyncTasksManager specified by manager_p. If this is false, then this SystemAsyncTask is not added to the given AsyncTasksManager.
command_sThe command line that this SystemAsyncTask will run. The SystemAsyncTask will make a deep copy of this value.
on_success_callback_fnIf the SystemAsyncTask runs successfully, this function will be called with the SystemAsyncTask's ServiceJob as its parameter.
Returns
The newly-allocated SystemAsyncTask or NULL upon error.

◆ SetSystemAsyncTaskCommand()

bool SetSystemAsyncTaskCommand ( SystemAsyncTask task_p,
const char *  command_s 
)

Set the command line for a SystemAsyncTask to run.

Parameters
task_pThe SystemAsyncTask to alter.
command_sThe command line to run. The SystemAsyncTask will make a deep-copy of this value.
Returns
true if the ServiceJob was altered successfully, false otherwise.

◆ FreeSystemAsyncTask()

void FreeSystemAsyncTask ( SystemAsyncTask task_p)

Free a SystemAsyncTask.

Parameters
task_pThe SystemAsyncTask to free.

◆ RunSystemAsyncTask()

bool RunSystemAsyncTask ( SystemAsyncTask task_p)

Run a SystemAsyncTask.

Parameters
task_pThe SystemAsyncTask to run.
Returns
true if the ServiceJob was started successfully, false otherwise.

Field Documentation

◆ std_async_task_p

AsyncTask* std_async_task_p

The underlying AsyncTask.

◆ std_async_task_mem

MEM_FLAG std_async_task_mem

The MEM_FLAG determining whether the AsyncTask pointed to by std_async_task_p will be deleted when this SystemAsyncTask is freed.

◆ std_service_job_p

ServiceJob* std_service_job_p

The ServiceJob that will run this SystemAsyncTask.

The SystemAsyncTask will not free this ServiceJob when the SystemAsyncTask is deleted so the ServiceJob will need to be freed separately.

◆ std_command_line_s

char* std_command_line_s

The command line that this SystemAsyncTask will run.

◆ std_on_success_callback_fn

void(* std_on_success_callback_fn) (ServiceJob *job_p)

The callback function that this SystemAsyncTask will call if it runs successfully.

If this is NULL, it will be ignored.


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