diff options
-rw-r--r-- | includes/TaskMan.h | 5 | ||||
-rw-r--r-- | tests/test-Http.cc | 7 |
2 files changed, 7 insertions, 5 deletions
diff --git a/includes/TaskMan.h b/includes/TaskMan.h index 6c446b7..68aaaf6 100644 --- a/includes/TaskMan.h +++ b/includes/TaskMan.h @@ -47,6 +47,11 @@ class TaskMan { r->threadStart(); return r; } + static void stopThreadedTaskMan(TaskManThread * tmt) { + tmt->stopMe(0); + tmt->join(); + delete tmt; + } bool stopped() { return m_stopped; } template<class T> static T * createTask(T * t, Task * stick = NULL) { TaskMan::registerTask(t, stick); return t; } diff --git a/tests/test-Http.cc b/tests/test-Http.cc index 9d4d0e3..bd0ef49 100644 --- a/tests/test-Http.cc +++ b/tests/test-Http.cc @@ -146,11 +146,8 @@ void MainTask::Do() { s->stop(); - for (int i = 0; i < NTHREADS; i++) { - tms[i]->stopMe(); - tms[i]->join(); - delete tms[i]; - } + for (int i = 0; i < NTHREADS; i++) + TaskMan::stopThreadedTaskMan(tms[i]); Printer::log(M_STATUS, "Test::Http passed."); } |