Change to use pthread_mutex directly. (ibex_close): Same.
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. svn path=/trunk/; revision=14565
This commit is contained in:
@ -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.
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
Reference in New Issue
Block a user