replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / resource / csdk / connectivity / inc / caqueueingthread.h
index 89efec1..91deeda 100644 (file)
@@ -30,7 +30,7 @@
 #include <stdint.h>
 
 #include "cathreadpool.h"
-#include "camutex.h"
+#include "octhread.h"
 #include "uqueue.h"
 #include "cacommon.h"
 #ifdef __cplusplus
@@ -44,14 +44,17 @@ typedef void (*CAThreadTask)(void *threadData);
 /** Data destroy function. **/
 typedef void (*CADataDestroyFunction)(void *data, uint32_t size);
 
+/** Context based Data destroy function. **/
+typedef bool (*CAContextDataDestroy)(void *data, uint32_t size, void *ctx);
+
 typedef struct
 {
     /** Thread pool of the thread started. **/
     ca_thread_pool_t threadPool;
     /** mutex for synchronization. **/
-    ca_mutex threadMutex;
+    oc_mutex threadMutex;
     /** conditional mutex for synchronization. **/
-    ca_cond threadCond;
+    oc_cond threadCond;
     /** Thread function to be invoked. **/
     CAThreadTask threadTask;
     /** Data destroy function. **/
@@ -78,8 +81,11 @@ CAResult_t CAQueueingThreadInitialize(CAQueueingThread_t *thread, ca_thread_pool
  * @param[in]   thread        thread data that needs to be started.
  * @return  CA_STATUS_OK or ERROR CODES (CAResult_t error codes in cacommon.h).
  */
+#ifndef __TIZENRT__
 CAResult_t CAQueueingThreadStart(CAQueueingThread_t *thread);
-
+#else
+CAResult_t CAQueueingThreadStart(CAQueueingThread_t *thread, const char *thread_name);
+#endif
 /**
  * Add queuing thread data for new thread.
  * @param[in]   thread       thread data for new thread control.
@@ -90,6 +96,23 @@ CAResult_t CAQueueingThreadStart(CAQueueingThread_t *thread);
 CAResult_t CAQueueingThreadAddData(CAQueueingThread_t *thread, void *data, uint32_t size);
 
 /**
+ * Clears queue thread data.
+ * @param[in]   thread       thread data for new thread control.
+ * @return  ::CA_STATUS_OK or Appropriate error code.
+ */
+CAResult_t CAQueueingThreadClearData(CAQueueingThread_t *thread);
+
+/**
+ * Clears queue thread data of specific context.
+ * @param[in]   thread           thread data for new thread control.
+ * @param[in]   callback         Function which should return true if the data
+ *                               needs to be deleted, else returns false
+ * @param[in]   ctx              Data to pass to callback
+ */
+CAResult_t CAQueueingThreadClearContextData(CAQueueingThread_t *thread,
+                                            CAContextDataDestroy callback, void *ctx);
+
+/**
  * Stop the queuing thread.
  * @param[in]   thread       thread data that needs to be started.
  * @return  CA_STATUS_OK or ERROR CODES (CAResult_t error codes in cacommon.h).