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 111 of file svutil.cpp.
◆ StartProcess()
void SVSync::StartProcess |
( |
const char * |
executable, |
|
|
const char * |
args |
|
) |
| |
|
static |
Starts a new process.
Definition at line 120 of file svutil.cpp.
122 proc.append(executable);
125 std::cout <<
"Starting " << proc << std::endl;
127 STARTUPINFO start_info;
128 PROCESS_INFORMATION proc_info;
129 GetStartupInfo(&start_info);
130 if (!CreateProcess(NULL, const_cast<char*>(proc.c_str()), NULL, NULL,
FALSE,
131 CREATE_NO_WINDOW | DETACHED_PROCESS, NULL, NULL,
132 &start_info, &proc_info))
141 prctl(PR_SET_PDEATHSIG, 2, 0, 0, 0);
143 char* mutable_args = strdup(args);
145 for (
int i = 0; mutable_args[i]; ++i) {
146 if (mutable_args[i] ==
' ') {
150 char** argv =
new char*[argc + 2];
151 argv[0] = strdup(executable);
152 argv[1] = mutable_args;
154 bool inquote =
false;
155 for (
int i = 0; mutable_args[i]; ++i) {
156 if (!inquote && mutable_args[i] ==
' ') {
157 mutable_args[i] =
'\0';
158 argv[argc++] = mutable_args + i + 1;
159 }
else if (mutable_args[i] ==
'"') {
161 mutable_args[i] =
' ';
165 execvp(executable, argv);
◆ StartThread()
void SVSync::StartThread |
( |
void *(*)(void *) |
func, |
|
|
void * |
arg |
|
) |
| |
|
static |
Create new thread.
Definition at line 87 of file svutil.cpp.
89 LPTHREAD_START_ROUTINE f = (LPTHREAD_START_ROUTINE)func;
91 HANDLE newthread = CreateThread(NULL,
100 pthread_attr_init(&attr);
101 pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
102 pthread_create(&helper, &attr, func, arg);
The documentation for this class was generated from the following files:
- /home/stefan/src/github/tesseract-ocr/tesseract/viewer/svutil.h
- /home/stefan/src/github/tesseract-ocr/tesseract/viewer/svutil.cpp