diff options
-rw-r--r-- | libibex/ChangeLog | 7 | ||||
-rw-r--r-- | libibex/ibex_block.c | 5 | ||||
-rw-r--r-- | libibex/ibex_internal.h | 12 |
3 files changed, 18 insertions, 6 deletions
diff --git a/libibex/ChangeLog b/libibex/ChangeLog index 46c89323ed..1b4a146585 100644 --- a/libibex/ChangeLog +++ b/libibex/ChangeLog @@ -1,3 +1,10 @@ +2001-11-01 <NotZed@Ximian.com> + + * ibex_block.c (ibex_open): Change to use pthread_mutex directly. + (ibex_close): Same. + + * ibex_internal.h: Changed to use pthread mutexes. Fixes #14218. + 2001-10-31 <NotZed@Ximian.com> * ibex_internal.h (IBEX_TRYLOCK): Added a trylock, used by ibex_use. diff --git a/libibex/ibex_block.c b/libibex/ibex_block.c index a6f810d4ae..054a8791cf 100644 --- a/libibex/ibex_block.c +++ b/libibex/ibex_block.c @@ -358,7 +358,7 @@ ibex *ibex_open (char *file, int flags, int mode) ib->mode = mode; #ifdef ENABLE_THREADS - ib->lock = g_mutex_new(); + pthread_mutex_init(&ib->lock, NULL); #endif IBEX_LIST_LOCK(ib); @@ -481,8 +481,9 @@ int ibex_close (ibex *ib) g_free(ib->name); #ifdef ENABLE_THREADS - g_mutex_free(ib->lock); + pthread_mutex_destroy(&ib->lock); #endif + g_free(ib); return ret; diff --git a/libibex/ibex_internal.h b/libibex/ibex_internal.h index 321b596f2a..aaba414d37 100644 --- a/libibex/ibex_internal.h +++ b/libibex/ibex_internal.h @@ -26,6 +26,10 @@ #include "block.h" #include "wordindex.h" +#ifdef ENABLE_THREADS +#include <pthread.h> +#endif + struct ibex { struct ibex *next; /* for list of open ibex's */ struct ibex *prev; @@ -40,7 +44,7 @@ struct ibex { int predone; #ifdef ENABLE_THREADS - GMutex *lock; + pthread_mutex_t lock; #endif }; @@ -50,9 +54,9 @@ struct ibex { #ifdef ENABLE_THREADS /*#define IBEX_LOCK(ib) (printf(__FILE__ "%d: %s: locking ibex\n", __LINE__, __FUNCTION__), g_mutex_lock(ib->lock)) #define IBEX_UNLOCK(ib) (printf(__FILE__ "%d: %s: unlocking ibex\n", __LINE__, __FUNCTION__), g_mutex_unlock(ib->lock))*/ -#define IBEX_LOCK(ib) (g_mutex_lock(ib->lock)) -#define IBEX_UNLOCK(ib) (g_mutex_unlock(ib->lock)) -#define IBEX_TRYLOCK(ib) (g_mutex_trylock(ib->lock)) +#define IBEX_LOCK(ib) (pthread_mutex_lock(&ib->lock)) +#define IBEX_UNLOCK(ib) (pthread_mutex_unlock(&ib->lock)) +#define IBEX_TRYLOCK(ib) (pthread_mutex_trylock(&ib->lock)) #else #define IBEX_LOCK(ib) #define IBEX_UNLOCK(ib) |