summaryrefslogtreecommitdiff
path: root/utils/MsgTask.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/MsgTask.cpp')
-rw-r--r--utils/MsgTask.cpp44
1 files changed, 9 insertions, 35 deletions
diff --git a/utils/MsgTask.cpp b/utils/MsgTask.cpp
index 794bf92..fdb1102 100644
--- a/utils/MsgTask.cpp
+++ b/utils/MsgTask.cpp
@@ -36,12 +36,19 @@
#include <log_util.h>
#include <loc_log.h>
-namespace loc_core {
-
static void LocMsgDestroy(void* msg) {
delete (LocMsg*)msg;
}
+MsgTask::MsgTask(LocThread::tCreate tCreator,
+ const char* threadName, bool joinable) :
+ mQ(msg_q_init2()), mThread(new LocThread()) {
+ if (!mThread->start(tCreator, threadName, this, joinable)) {
+ delete mThread;
+ mThread = NULL;
+ }
+}
+
MsgTask::MsgTask(const char* threadName, bool joinable) :
mQ(msg_q_init2()), mThread(new LocThread()) {
if (!mThread->start(threadName, this, joinable)) {
@@ -93,36 +100,3 @@ bool MsgTask::run() {
return true;
}
-
-// TODO: remove the below in the next patch
-void MsgTask::associate(tAssociate tAssociator) const {
- struct LocAssociateMsg : public LocMsg {
- tAssociate mAssociator;
- LocAssociateMsg(tAssociate associator) :
- mAssociator(associator) {}
- inline virtual void proc() const {
- mAssociator();
- }
- };
- sendMsg(new LocAssociateMsg(tAssociator));
-}
-
-MsgTask::MsgTask(tCreate tCreator, const char* threadName) :
- mQ(msg_q_init2()), mThread(new LocThread()) {
- if (!mThread->start(threadName, this, false)) {
- delete mThread;
- mThread = NULL;
- }
-}
-
-MsgTask::MsgTask(tAssociate tAssociator, const char* threadName) :
- mQ(msg_q_init2()), mThread(new LocThread()) {
- if (!mThread->start(threadName, this, false)) {
- delete mThread;
- mThread = NULL;
- } else if (tAssociator != NULL){
- associate(tAssociator);
- }
-}
-
-} // namespace loc_core