diff options
author | Rob Crittenden <rcritten@redhat.com> | 2011-08-15 13:20:33 -0400 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2011-08-24 13:57:37 +0200 |
commit | 0147ef5b73c5b5345dd9bdb5d273ffcf8cb20cab (patch) | |
tree | 93048035db8561cd4eb7332d4b332cf093d05bb3 /daemons/ipa-slapi-plugins/ipa-modrdn | |
parent | 17a86397cef3de7597e72cf49bb071cb1f9d1418 (diff) | |
download | freeipa-0147ef5b73c5b5345dd9bdb5d273ffcf8cb20cab.tar.gz freeipa-0147ef5b73c5b5345dd9bdb5d273ffcf8cb20cab.tar.xz freeipa-0147ef5b73c5b5345dd9bdb5d273ffcf8cb20cab.zip |
Fix thread deadlock by using pthreads library instead of NSPR.
The 389-ds team is in the process of exposing slapi_rwlock which we
will switch to when it is available.
https://fedorahosted.org/freeipa/ticket/1630
Diffstat (limited to 'daemons/ipa-slapi-plugins/ipa-modrdn')
-rw-r--r-- | daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c b/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c index 45a29a510..91cc2cccc 100644 --- a/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c +++ b/daemons/ipa-slapi-plugins/ipa-modrdn/ipa_modrdn.c @@ -42,6 +42,7 @@ #include "slapi-plugin.h" #include "nspr.h" #include "prclist.h" +#include <pthread.h> #include "util.h" @@ -88,7 +89,7 @@ struct configEntry { }; static PRCList *ipamodrdn_global_config = NULL; -static PRRWLock *g_ipamodrdn_cache_lock; +static pthread_rwlock_t g_ipamodrdn_cache_lock; static void *_PluginID = NULL; static char *_PluginDN = NULL; @@ -144,17 +145,17 @@ void ipamodrdn_dump_config_entry(struct configEntry *); */ void ipamodrdn_read_lock(void) { - PR_RWLock_Rlock(g_ipamodrdn_cache_lock); + pthread_rwlock_rdlock(&g_ipamodrdn_cache_lock); } void ipamodrdn_write_lock(void) { - PR_RWLock_Wlock(g_ipamodrdn_cache_lock); + pthread_rwlock_wrlock(&g_ipamodrdn_cache_lock); } void ipamodrdn_unlock(void) { - PR_RWLock_Unlock(g_ipamodrdn_cache_lock); + pthread_rwlock_unlock(&g_ipamodrdn_cache_lock); } /** @@ -255,9 +256,7 @@ ipamodrdn_start(Slapi_PBlock * pb) goto done; } - g_ipamodrdn_cache_lock = PR_NewRWLock(PR_RWLOCK_RANK_NONE, "ipaModRDN"); - - if (!g_ipamodrdn_cache_lock) { + if (pthread_rwlock_init(&g_ipamodrdn_cache_lock, NULL) != 0) { LOG_FATAL("lock creation failed\n"); return EFAIL; |