projects
/
userspace-rcu.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: auto-resize hash table destroy deadlock
[userspace-rcu.git]
/
src
/
urcu-call-rcu-impl.h
diff --git
a/src/urcu-call-rcu-impl.h
b/src/urcu-call-rcu-impl.h
index e9366b42355b8b0db313cca083b121017192852b..1aba04a9a15e320fd9ae9a5ab2387fca643439db 100644
(file)
--- a/
src/urcu-call-rcu-impl.h
+++ b/
src/urcu-call-rcu-impl.h
@@
-102,7
+102,6
@@
static pthread_mutex_t call_rcu_mutex = PTHREAD_MUTEX_INITIALIZER;
static struct call_rcu_data *default_call_rcu_data;
static struct urcu_atfork *registered_rculfhash_atfork;
static struct call_rcu_data *default_call_rcu_data;
static struct urcu_atfork *registered_rculfhash_atfork;
-static unsigned long registered_rculfhash_atfork_refcount;
/*
* If the sched_getcpu() and sysconf(_SC_NPROCESSORS_CONF) calls are
/*
* If the sched_getcpu() and sysconf(_SC_NPROCESSORS_CONF) calls are
@@
-434,6
+433,7
@@
static void call_rcu_data_init(struct call_rcu_data **crdpp,
{
struct call_rcu_data *crdp;
int ret;
{
struct call_rcu_data *crdp;
int ret;
+ sigset_t newmask, oldmask;
crdp = malloc(sizeof(*crdp));
if (crdp == NULL)
crdp = malloc(sizeof(*crdp));
if (crdp == NULL)
@@
-448,9
+448,18
@@
static void call_rcu_data_init(struct call_rcu_data **crdpp,
crdp->gp_count = 0;
cmm_smp_mb(); /* Structure initialized before pointer is planted. */
*crdpp = crdp;
crdp->gp_count = 0;
cmm_smp_mb(); /* Structure initialized before pointer is planted. */
*crdpp = crdp;
+
+ ret = sigfillset(&newmask);
+ urcu_posix_assert(!ret);
+ ret = pthread_sigmask(SIG_BLOCK, &newmask, &oldmask);
+ urcu_posix_assert(!ret);
+
ret = pthread_create(&crdp->tid, NULL, call_rcu_thread, crdp);
if (ret)
urcu_die(ret);
ret = pthread_create(&crdp->tid, NULL, call_rcu_thread, crdp);
if (ret)
urcu_die(ret);
+
+ ret = pthread_sigmask(SIG_SETMASK, &oldmask, NULL);
+ urcu_posix_assert(!ret);
}
/*
}
/*
@@
-1018,20
+1027,20
@@
void call_rcu_after_fork_child(void)
void urcu_register_rculfhash_atfork(struct urcu_atfork *atfork)
{
void urcu_register_rculfhash_atfork(struct urcu_atfork *atfork)
{
+ if (CMM_LOAD_SHARED(registered_rculfhash_atfork))
+ return;
call_rcu_lock(&call_rcu_mutex);
call_rcu_lock(&call_rcu_mutex);
- if (registered_rculfhash_atfork_refcount++)
- goto end;
- registered_rculfhash_atfork = atfork;
-end:
+ if (!registered_rculfhash_atfork)
+ registered_rculfhash_atfork = atfork;
call_rcu_unlock(&call_rcu_mutex);
}
call_rcu_unlock(&call_rcu_mutex);
}
+/*
+ * This unregistration function is deprecated, meant only for internal
+ * use by rculfhash.
+ */
+__attribute__((noreturn))
void urcu_unregister_rculfhash_atfork(struct urcu_atfork *atfork __attribute__((unused)))
{
void urcu_unregister_rculfhash_atfork(struct urcu_atfork *atfork __attribute__((unused)))
{
- call_rcu_lock(&call_rcu_mutex);
- if (--registered_rculfhash_atfork_refcount)
- goto end;
- registered_rculfhash_atfork = NULL;
-end:
- call_rcu_unlock(&call_rcu_mutex);
+ urcu_die(EPERM);
}
}
This page took
0.023546 seconds
and
4
git commands to generate.