X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Fcsdk%2Fconnectivity%2Finc%2Fcaqueueingthread.h;h=91deedafcbbf3e6e39a374fdd2700cec06feb476;hb=3c093548382bb2542c87a67e6e5fa32552c29cb3;hp=89efec19410637ca13f704b7852242b09bd75ede;hpb=edcfc3d2329da7b914771c0dcff5f42c9b74fd93;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/csdk/connectivity/inc/caqueueingthread.h b/resource/csdk/connectivity/inc/caqueueingthread.h index 89efec1..91deeda 100644 --- a/resource/csdk/connectivity/inc/caqueueingthread.h +++ b/resource/csdk/connectivity/inc/caqueueingthread.h @@ -30,7 +30,7 @@ #include #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).