[uim-commit] r1882 - in trunk: . uim

yamaken at freedesktop.org yamaken at freedesktop.org
Wed Oct 26 11:45:16 PDT 2005


Author: yamaken
Date: 2005-10-26 11:45:13 -0700 (Wed, 26 Oct 2005)
New Revision: 1882

Modified:
   trunk/configure.ac
   trunk/uim/uim-internal.h
   trunk/uim/uim.c
Log:
* configure.ac
  - Revert incomplete pthread-related codes as notified in [Anthy-dev
    2571]
* uim/uim-internal.h
  - (UIM_DEFINE_MUTEX, UIM_DEFINE_MUTEX_STATIC, UIM_LOCK_MUTEX,
    UIM_UNLOCK_MUTEX, UIM_EVAL_FSTRING1_WITH_MUTEX,
    UIM_EVAL_FSTRING2_WITH_MUTEX, UIM_EVAL_FSTRING3_WITH_MUTEX): Ditto
* uim/uim.c
  - (mtx_initing_or_quiting, mtx_context_array, get_context_id,
    put_context_id, uim_find_context, uim_init, uim_quit): Ditto


Modified: trunk/configure.ac
===================================================================
--- trunk/configure.ac	2005-10-26 17:08:04 UTC (rev 1881)
+++ trunk/configure.ac	2005-10-26 18:45:13 UTC (rev 1882)
@@ -174,7 +174,6 @@
 AC_CHECK_HEADERS([pty.h utmp.h util.h libutil.h])
 AC_CHECK_HEADERS([curses.h stropts.h])
 AC_CHECK_HEADERS([sys/param.h strings.h])
-AC_CHECK_HEADERS([pthread.h], have_pthread=yes, have_pthread=no)
 
 # Check for type
 AC_CHECK_TYPES(sig_atomic_t, , ,
@@ -544,7 +543,6 @@
 AM_CONDITIONAL(COMPAT_TABLE, test x$enable_compat_table = xyes)
 AM_CONDITIONAL(NEED_SETENV_C, test $ac_cv_func_setenv = no -o $ac_cv_func_unsetenv = no)
 AM_CONDITIONAL(NEED_STRSEP_C, test $ac_cv_func_strsep = no)
-AM_CONDITIONAL(HAVE_PTHREAD, test "x$have_pthread" = "xyes")
 
 if test "x$use_applet" = "xyes"; then
   AC_PROG_INTLTOOL
@@ -811,7 +809,6 @@
    DICT            : ${use_dict}
    EB              : ${use_eb}
    libedit         : ${use_libedit}
-   pthread         : ${have_pthread}
    Default toolkit : ${default_toolkit}
 ])
 

Modified: trunk/uim/uim-internal.h
===================================================================
--- trunk/uim/uim-internal.h	2005-10-26 17:08:04 UTC (rev 1881)
+++ trunk/uim/uim-internal.h	2005-10-26 18:45:13 UTC (rev 1882)
@@ -121,21 +121,6 @@
   int nr_psegs;
 };
 
-#ifdef HAVE_PTHREAD_H
-#include <pthread.h>
-  #define UIM_DEFINE_MUTEX(mtx)                                              \
-           pthread_mutex_t mtx = PTHREAD_MUTEX_INITIALIZER
-  #define UIM_DEFINE_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_DEFINE_MUTEX(mtx)
-  #define UIM_DEFINE_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; \
@@ -171,38 +156,6 @@
     UIM_RESTORE_TEXTDOMAIN_CODESET(); \
   }
 
-#ifdef HAVE_PTHREAD_H
-
-  extern pthread_mutex_t mtx_uim_evaling;
-
-  #define UIM_EVAL_FSTRING1_WITH_MUTEX(uc, sexp_tmpl, arg1)             \
-    UIM_LOCK_MUTEX(mtx_uim_evaling);                                       \
-    UIM_EVAL_FSTRING1(uc, sexp_tmpl, arg1);                             \
-    UIM_UNLOCK_MUTEX(mtx_uim_evaling);
-
-  #define UIM_EVAL_FSTRING2_WITH_MUTEX(uc, sexp_tmpl, arg1, arg2)       \
-    UIM_LOCK_MUTEX(mtx_uim_evaling);                                       \
-    UIM_EVAL_FSTRING2(uc, sexp_tmpl, arg1, arg2);		        \
-    UIM_UNLOCK_MUTEX(mtx_uim_evaling);
-
-  #define UIM_EVAL_FSTRING3_WITH_MUTEX(uc, sexp_tmpl, arg1, arg2, arg3) \
-    UIM_LOCK_MUTEX(mtx_uim_evaling);                                       \
-    UIM_EVAL_FSTRING3(uc, sexp_tmpl, arg1, arg2, arg3);			\
-    UIM_UNLOCK_MUTEX(mtx_uim_evaling);
-
-#else
-
-  #define UIM_EVAL_FSTRING1_WITH_MUTEX(uc, sexp_tmpl, arg1)             \
-    UIM_EVAL_FSTRING1(uc, sexp_tmpl, arg1);
-
-  #define UIM_EVAL_FSTRING2_WITH_MUTEX(uc, sexp_tmpl, arg1, arg2)       \
-    UIM_EVAL_FSTRING2(uc, sexp_tmpl, arg1, arg2);
-
-  #define UIM_EVAL_FSTRING3_WITH_MUTEX(uc, sexp_tmpl, arg1, arg2, arg3) \
-    UIM_EVAL_FSTRING3(uc, sexp_tmpl, arg1, arg2, arg3);
-
-#endif /* HAVE_PTHREAD_H */
-
 #define UIM_EVAL_FSTRING1(uc, sexp_tmpl, arg1) \
   { \
     int form_size; \

Modified: trunk/uim/uim.c
===================================================================
--- trunk/uim/uim.c	2005-10-26 17:08:04 UTC (rev 1881)
+++ trunk/uim/uim.c	2005-10-26 18:45:13 UTC (rev 1882)
@@ -60,10 +60,6 @@
 int uim_nr_im;
 static int uim_initialized;
 
-/* Definition of mutex */
-UIM_DEFINE_MUTEX_STATIC(mtx_initing_or_quiting);
-UIM_DEFINE_MUTEX_STATIC(mtx_context_array);
-
 void
 uim_set_preedit_cb(uim_context uc,
 		   void (*clear_cb)(void *ptr),
@@ -81,25 +77,20 @@
 get_context_id(uim_context uc)
 {
   int i;
-  UIM_LOCK_MUTEX(mtx_context_array);
   for (i = 0; i < CONTEXT_ARRAY_SIZE; i++) {
     if (!context_array[i]) {
       context_array[i] = uc;
       uc->id = i;
-      UIM_UNLOCK_MUTEX(mtx_context_array);
       return;
     }
   }
   uc->id = -1;
-  UIM_UNLOCK_MUTEX(mtx_context_array);
 }
 
 static void
 put_context_id(uim_context uc)
 {
-  UIM_LOCK_MUTEX(mtx_context_array);
   context_array[uc->id] = NULL;
-  UIM_UNLOCK_MUTEX(mtx_context_array);
 }
 
 uim_context
@@ -289,9 +280,7 @@
 uim_find_context(int id)
 {
   uim_context uc;
-  UIM_LOCK_MUTEX(mtx_context_array);
   uc = context_array[id];
-  UIM_UNLOCK_MUTEX(mtx_context_array);
   return uc;
 }
 
@@ -695,19 +684,15 @@
 int
 uim_init(void)
 {
-  UIM_LOCK_MUTEX(mtx_initing_or_quiting);
-
-  if (uim_initialized) {
-    UIM_UNLOCK_MUTEX(mtx_initing_or_quiting);
+  if (uim_initialized)
     return 0;
-  }
+
   uim_last_client_encoding = NULL;
   uim_im_array = NULL;
   uim_nr_im = 0;
   uim_init_scm();
   uim_initialized = 1;
 
-  UIM_UNLOCK_MUTEX(mtx_initing_or_quiting);
   return 0;
 }
 
@@ -716,12 +701,8 @@
 {
   int i;
 
-  UIM_LOCK_MUTEX(mtx_initing_or_quiting);
-  
-  if (!uim_initialized) {
-    UIM_UNLOCK_MUTEX(mtx_initing_or_quiting);
+  if (!uim_initialized)
     return;
-  }
 
   /* release still active contexts */
   for (i = 0; i < CONTEXT_ARRAY_SIZE; i++) {
@@ -735,5 +716,4 @@
   free(uim_last_client_encoding);
   uim_last_client_encoding = NULL;
   uim_initialized = 0;
-  UIM_UNLOCK_MUTEX(mtx_initing_or_quiting);
 }



More information about the uim-commit mailing list