diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/kdb/ChangeLog | 9 | ||||
| -rw-r--r-- | src/lib/kdb/kdb5.c | 20 | ||||
| -rw-r--r-- | src/lib/kdb/kdb5.h | 4 |
3 files changed, 11 insertions, 22 deletions
diff --git a/src/lib/kdb/ChangeLog b/src/lib/kdb/ChangeLog index ae159d434..b6677ffee 100644 --- a/src/lib/kdb/ChangeLog +++ b/src/lib/kdb/ChangeLog @@ -1,3 +1,12 @@ +2006-01-25 Ken Raeburn <raeburn@mit.edu> + + * kdb5.h (struct _db_library): Delete unlocked and lock_holder + fields. + (struct _kdb_vftabl): Delete is_thread_safe field. + * kdb5.c (kdb_init_lib_lock, kdb_destroy_lib_lock, + kdb_lock_lib_lock, kdb_unlock_lib_lock): Delete references. + Assume the plugin is always thread-safe. + 2005-12-02 Ken Raeburn <raeburn@mit.edu> * kdb5.c (kdb_load_library): Make dbpath_names static, to keep diff --git a/src/lib/kdb/kdb5.c b/src/lib/kdb/kdb5.c index 91f4f8ee3..156ebb65a 100644 --- a/src/lib/kdb/kdb5.c +++ b/src/lib/kdb/kdb5.c @@ -84,11 +84,10 @@ kdb_init_lib_lock(db_library lib) return retval; } - lib->lock_holder = pthread_self(); lib->excl = 0; lib->recursive_cnt = 0; - return pthread_cond_init(&lib->unlocked, NULL); + return 0; } static int @@ -99,7 +98,7 @@ kdb_destroy_lib_lock(db_library lib) return retval; } - return pthread_cond_destroy(&lib->unlocked); + return 0; } static int @@ -108,20 +107,10 @@ kdb_lock_lib_lock(db_library lib, krb5_boolean exclusive) /* Since, handle locked by one thread should not allow another thread to continue. */ krb5_error_code retval = 0; - pthread_t myid = pthread_self(); if ((retval = pthread_mutex_lock(&lib->lib_lock))) return retval; - while ((exclusive && (lib->excl || lib->recursive_cnt)) || - (!pthread_equal(lib->lock_holder, myid) - && !lib->vftabl.is_thread_safe && lib->recursive_cnt)) { - /* Exclusive lock held or some one using lock when exclusive - is requested or library not-re-entrant. */ - if ((retval = pthread_cond_wait(&lib->unlocked, &lib->lib_lock))) - return retval; - } - /* exclusive lock and recursive_cnt allow a thread to lock even it already holds a lock */ if (exclusive) @@ -129,8 +118,6 @@ kdb_lock_lib_lock(db_library lib, krb5_boolean exclusive) lib->recursive_cnt++; - lib->lock_holder = myid; - return pthread_mutex_unlock(&lib->lib_lock); } @@ -146,9 +133,6 @@ kdb_unlock_lib_lock(db_library lib, krb5_boolean exclusive) if (exclusive) lib->excl--; - if ((retval = pthread_cond_broadcast(&lib->unlocked))) - return retval; - return pthread_mutex_unlock(&lib->lib_lock); } diff --git a/src/lib/kdb/kdb5.h b/src/lib/kdb/kdb5.h index 93b594a52..4027849e0 100644 --- a/src/lib/kdb/kdb5.h +++ b/src/lib/kdb/kdb5.h @@ -49,8 +49,6 @@ typedef struct _kdb_vftabl{ short int maj_ver; short int min_ver; - short int is_thread_safe; - krb5_error_code (*init_library)(krb5_set_err_func_t); krb5_error_code (*fini_library)(); krb5_error_code (*init_module) ( krb5_context kcontext, @@ -200,9 +198,7 @@ typedef struct _db_library { int reference_cnt; #ifdef HAVE_PTHREAD_H pthread_mutex_t lib_lock; - pthread_cond_t unlocked; /* To check whether some one has called db_unlock */ int recursive_cnt; /* this is used as lock to help recursive locking */ - pthread_t lock_holder; int excl; #endif void *dl_handle; |
