thread: remove caller_tid information when adding and removing thread_cb
[platform/core/uifw/libtdm.git] / src / tdm_macro.h
index 80be131..acdc9f3 100644 (file)
@@ -461,6 +461,29 @@ static inline int TDM_MUTEX_IS_LOCKED(void)
 #define tdm_display_unlock(dpy)   _pthread_mutex_unlock(&((tdm_private_display *)dpy)->lock)
 
 
+/* debugging mutex ************************************************************/
+extern pthread_mutex_t tdm_debug_mutex_check_lock;
+extern const char *tdm_debug_mutex_lock_func;
+extern int tdm_debug_mutex_lock_line;
+
+#define _debug_pthread_mutex_lock(l) \
+       do { \
+               pthread_mutex_lock(l); \
+               pthread_mutex_lock(&tdm_debug_mutex_check_lock); \
+               tdm_debug_mutex_lock_func = __FUNCTION__; \
+               tdm_debug_mutex_lock_line = __LINE__; \
+               pthread_mutex_unlock(&tdm_debug_mutex_check_lock); \
+       } while (0)
+
+#define _debug_pthread_mutex_unlock(l) \
+       do { \
+               pthread_mutex_lock(&tdm_debug_mutex_check_lock); \
+               tdm_debug_mutex_lock_func = NULL; \
+               tdm_debug_mutex_lock_line = 0; \
+               pthread_mutex_unlock(&tdm_debug_mutex_check_lock); \
+               pthread_mutex_unlock(l); \
+       } while (0)
+
 #ifdef __cplusplus
 }
 #endif