diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-08-05 16:06:16 -0400 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2013-08-05 16:06:16 -0400 |
| commit | a7c4cbe53aad51b3e74fa9cb1af975cb8d356954 (patch) | |
| tree | e4578c51ea7239aeaf5dd6ebcaa844a0fb00f9ea /node/Service.cpp | |
| parent | 3368330b777da9561539c04ea589aa7060e1d569 (diff) | |
| download | infinitytier-a7c4cbe53aad51b3e74fa9cb1af975cb8d356954.tar.gz infinitytier-a7c4cbe53aad51b3e74fa9cb1af975cb8d356954.zip | |
CLI debugging, got rid of nasty old Thread class and replaced with newer cleaner portable idiom.
Diffstat (limited to 'node/Service.cpp')
| -rw-r--r-- | node/Service.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/node/Service.cpp b/node/Service.cpp index c614e4e4..0d4702f8 100644 --- a/node/Service.cpp +++ b/node/Service.cpp @@ -62,7 +62,7 @@ Service::Service(const RuntimeEnvironment *renv,const char *name,const char *pat _childStderr(0), _run(true) { - start(); + _thread = Thread<Service>::start(this); } Service::~Service() @@ -77,14 +77,14 @@ Service::~Service() pid = 0; break; } - Thread::sleep(100); + Thread<Service>::sleep(100); } if (pid > 0) { ::kill(pid,SIGKILL); waitpid(pid,&st,0); } } - join(); + Thread<Service>::join(_thread); } bool Service::send(const Dictionary &msg) @@ -107,7 +107,7 @@ bool Service::send(const Dictionary &msg) return true; } -void Service::main() +void Service::threadMain() throw() { char buf[131072]; @@ -136,7 +136,7 @@ void Service::main() close(in[0]); close(out[1]); close(err[1]); - Thread::sleep(500); // give child time to start + Thread<Service>::sleep(500); // give child time to start _childStdin = in[1]; _childStdout = out[0]; _childStderr = err[0]; @@ -168,7 +168,7 @@ void Service::main() LOG("service %s exited with exit code: %d, delaying 1s to attempt relaunch",_name.c_str(),st); - Thread::sleep(1000); // wait to relaunch + Thread<Service>::sleep(1000); // wait to relaunch continue; } } |
