The SVSync class provides functionality for Thread & Process Creation.
More...
#include <svutil.h>
The SVSync class provides functionality for Thread & Process Creation.
Definition at line 58 of file svutil.h.
◆ ExitThread()
void SVSync::ExitThread |
( |
| ) |
|
|
static |
Signals a thread to exit.
Definition at line 91 of file svutil.cpp.
◆ StartProcess()
void SVSync::StartProcess |
( |
const char * |
executable, |
|
|
const char * |
args |
|
) |
| |
|
static |
Starts a new process.
Definition at line 100 of file svutil.cpp.
102 proc.append(executable);
105 std::cout <<
"Starting " << proc << std::endl;
107 STARTUPINFO start_info;
108 PROCESS_INFORMATION proc_info;
109 GetStartupInfo(&start_info);
110 if (!CreateProcess(NULL, const_cast<char*>(proc.c_str()), NULL, NULL,
FALSE,
111 CREATE_NO_WINDOW | DETACHED_PROCESS, NULL, NULL,
112 &start_info, &proc_info))
121 prctl(PR_SET_PDEATHSIG, 2, 0, 0, 0);
123 char* mutable_args = strdup(args);
125 for (
int i = 0; mutable_args[i]; ++i) {
126 if (mutable_args[i] ==
' ') {
130 char** argv =
new char*[argc + 2];
131 argv[0] = strdup(executable);
132 argv[1] = mutable_args;
134 bool inquote =
false;
135 for (
int i = 0; mutable_args[i]; ++i) {
136 if (!inquote && mutable_args[i] ==
' ') {
137 mutable_args[i] =
'\0';
138 argv[argc++] = mutable_args + i + 1;
139 }
else if (mutable_args[i] ==
'"') {
141 mutable_args[i] =
' ';
145 execvp(executable, argv);
◆ StartThread()
void SVSync::StartThread |
( |
void *(*)(void *) |
func, |
|
|
void * |
arg |
|
) |
| |
|
static |
Create new thread.
Definition at line 192 of file svutil.cpp.
194 LPTHREAD_START_ROUTINE f = (LPTHREAD_START_ROUTINE) func;
196 HANDLE newthread = CreateThread(
206 pthread_attr_init(&attr);
207 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
208 pthread_create(&helper, &attr, func, arg);
The documentation for this class was generated from the following files: