summaryrefslogtreecommitdiff
path: root/lib-contact/ct-common/inc/CtThread.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib-contact/ct-common/inc/CtThread.h')
-rw-r--r--lib-contact/ct-common/inc/CtThread.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/lib-contact/ct-common/inc/CtThread.h b/lib-contact/ct-common/inc/CtThread.h
new file mode 100644
index 0000000..353f5dc
--- /dev/null
+++ b/lib-contact/ct-common/inc/CtThread.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef _CT_THREAD_H_
+#define _CT_THREAD_H_
+
+#include <pthread.h>
+#include <Eina.h>
+#include <Ecore.h>
+
+
+typedef void* PTHREAD_FN;
+typedef void (*ctThreadJob)(void *data);
+typedef void (*ctThreadCompleteCb)(void *data);
+
+class CtThread
+{
+public:
+ CtThread(ctThreadJob job, void *jobData, ctThreadCompleteCb completeCb, void *completeCbData);
+
+ void start();
+ void cancel();
+ void destroy();
+
+
+private:
+
+ ~CtThread();
+
+ void __cancel();
+
+ static Eina_Bool __ctThreadTimerCb(void *data);
+ static PTHREAD_FN __ctThreadJob(void *data);
+
+
+private:
+
+ bool __isAlive;
+ bool __isComplete;
+ pthread_t __pthread;
+ Ecore_Timer *__timer;
+ ctThreadJob __job;
+ void *__jobData;
+ ctThreadCompleteCb __completeCb;
+ void *__completeCbData;
+
+};
+
+
+#endif //_CT_THREAD_H_
+