[uim-commit] r1320 - trunk/uim

tkng at freedesktop.org tkng at freedesktop.org
Thu Aug 25 15:42:13 PDT 2005


Author: tkng
Date: 2005-08-25 15:42:11 -0700 (Thu, 25 Aug 2005)
New Revision: 1320

Modified:
   trunk/uim/context.h
Log:
* uim/context.h: Added new macros for pthread mutex.
 -(UIM_NEW_MUTEX, UIM_NEW_MUTEX_STATIC, UIM_LOCK_MUTEX,
   UIM_UNLOCK_MUTEX): New macros.


Modified: trunk/uim/context.h
===================================================================
--- trunk/uim/context.h	2005-08-25 21:59:48 UTC (rev 1319)
+++ trunk/uim/context.h	2005-08-25 22:42:11 UTC (rev 1320)
@@ -120,6 +120,20 @@
 };
 
 
+#ifdef HAVE_PTHREAD_H
+#include <pthread.h>
+  #define UIM_NEW_MUTEX(mtx)                pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER
+  #define UIM_NEW_MUTEX_STATIC(mtx)  static pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER
+  #define UIM_LOCK_MUTEX(mtx)    pthread_mutex_lock(&mtx)
+  #define UIM_UNLOCK_MUTEX(mtx)  pthread_mutex_unlock(&mtx)
+#else
+  #define UIM_NEW_MUTEX(mtx)
+  #define UIM_NEW_MUTEX_STATIC(mtx)
+  #define UIM_LOCK_MUTEX(mtx)
+  #define UIM_UNLOCK_MUTEX(mtx)
+#endif /* HAVE_PTHREAD_H */
+
+
 #ifdef ENABLE_NLS
 #define UIM_PREPARE_SAVING_TEXTDOMAIN_CODESET() \
     char *enc, *orig_encoding = NULL; \



More information about the uim-commit mailing list