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.
system_async_task.h
Go to the documentation of this file.
1 /*
2 ** Copyright 2014-2016 The Earlham Institute
3 **
4 ** Licensed under the Apache License, Version 2.0 (the "License");
5 ** you may not use this file except in compliance with the License.
6 ** You may obtain a copy of the License at
7 **
8 ** http://www.apache.org/licenses/LICENSE-2.0
9 **
10 ** Unless required by applicable law or agreed to in writing, software
11 ** distributed under the License is distributed on an "AS IS" BASIS,
12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 ** See the License for the specific language governing permissions and
14 ** limitations under the License.
15 */
16 
27 #ifndef SHARED_SRC_UTIL_INCLUDE_PROCESS_H_
28 #define SHARED_SRC_UTIL_INCLUDE_PROCESS_H_
29 
30 
32 #include "typedefs.h"
33 #include "operation.h"
34 #include "service_job.h"
35 #include "jobs_manager.h"
36 #include "async_task.h"
37 #include "memory_allocations.h"
38 
39 
44 typedef struct SystemAsyncTask
45 {
48 
54 
62 
65 
73 
74 
75 
76 
77 #ifdef __cplusplus
78 extern "C"
79 {
80 #endif
81 
82 
101 GRASSROOTS_TASK_API SystemAsyncTask *AllocateSystemAsyncTask (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));
102 
103 
114 GRASSROOTS_TASK_API bool SetSystemAsyncTaskCommand (SystemAsyncTask *task_p, const char *command_s);
115 
116 
124 
125 
135 
136 
147 GRASSROOTS_TASK_LOCAL void RunSystemAsyncTaskSuccess (SystemAsyncTask *task_p, ServiceJob *job_p);
148 
149 
150 
151 
152 GRASSROOTS_TASK_LOCAL OperationStatus ActualRunSystemAsyncTask (SystemAsyncTask *task_p);
153 
154 #ifdef __cplusplus
155 }
156 #endif
157 
158 
159 #endif /* SHARED_SRC_UTIL_INCLUDE_PROCESS_H_ */
GRASSROOTS_TASK_LOCAL
#define GRASSROOTS_TASK_LOCAL
Definition: grassroots_task_library.h:47
SystemAsyncTask::std_command_line_s
char * std_command_line_s
The command line that this SystemAsyncTask will run.
Definition: system_async_task.h:64
SystemAsyncTask::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.
Definition: system_async_task.h:71
MEM_FLAG
MEM_FLAG
An enum specifying the particular status of a piece of dynamically allocated memory for a particular ...
Definition: memory_allocations.h:38
SystemAsyncTask::SetSystemAsyncTaskCommand
bool SetSystemAsyncTaskCommand(SystemAsyncTask *task_p, const char *command_s)
Set the command line for a SystemAsyncTask to run.
grassroots_task_library.h
ServiceJob
A datatype to represent a running task.
Definition: service_job.h:72
operation.h
SystemAsyncTask::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 th...
Definition: system_async_task.h:53
AsyncTask
A datatype to use to run tasks asynchronously.
Definition: async_task.h:25
typedefs.h
jobs_manager.h
SystemAsyncTask::std_async_task_p
AsyncTask * std_async_task_p
The underlying AsyncTask.
Definition: system_async_task.h:47
SystemAsyncTask::std_service_job_p
ServiceJob * std_service_job_p
The ServiceJob that will run this SystemAsyncTask.
Definition: system_async_task.h:61
GRASSROOTS_TASK_API
#define GRASSROOTS_TASK_API
Definition: grassroots_task_library.h:46
SystemAsyncTask::RunSystemAsyncTask
bool RunSystemAsyncTask(SystemAsyncTask *task_p)
Run a SystemAsyncTask.
OperationStatus
OperationStatus
The current status of an Operation.
Definition: operation.h:96
AsyncTasksManager
A datatype for storing AsyncTasks in a collection.
Definition: async_tasks_manager.h:24
service_job.h
async_task.h
SystemAsyncTask::FreeSystemAsyncTask
void FreeSystemAsyncTask(SystemAsyncTask *task_p)
Free a SystemAsyncTask.
memory_allocations.h
SystemAsyncTask
A datatype to allow the running of command-line applications in a separate task.
Definition: system_async_task.h:44
SystemAsyncTask::AllocateSystemAsyncTask
SystemAsyncTask * AllocateSystemAsyncTask(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.