-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.h
More file actions
27 lines (22 loc) · 1.27 KB
/
process.h
File metadata and controls
27 lines (22 loc) · 1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef ROBINWAITA_PROCESS_H
#define ROBINWAITA_PROCESS_H
#include <sys/time.h>
//callbacks for log and timer (for some separation of UI and process management)
typedef void (*logCallback)(const char *message, void *user_data);
typedef void (*timerCallback)(unsigned int timer_id, void *user_data);
typedef struct initData initData;
typedef struct {
char *name; //process name
char **args; //any arguments we're passing to the process
int state; //STATES || 0: not started, not running | 1: running | 2: started, paused | 3: completed
pid_t pid; //process ID
struct timeval startTime; //process start time
struct timeval endTime; //process end time
} Process;
Process *newProcess(int processType); //create new process struct
void startProcess(Process *process, initData *data); //start process (fork into child and then execute python process)
void stopProcess(Process *process, initData *data); //stop process
void continueProcess(Process *process, initData *data); //continue process from stop
void setLogCallback(struct initData *data, logCallback callback, void *userData); //set callback function for logs
void setTimerCallback(struct initData *data, timerCallback callback, void *userData); //set callback function for timer info
#endif //ROBINWAITA_PROCESS_H