summaryrefslogtreecommitdiff
path: root/lib/ovs-thread.c
diff options
context:
space:
mode:
authorAndy Zhou <azhou@ovn.org>2016-06-17 15:41:26 -0700
committerAndy Zhou <azhou@ovn.org>2016-07-05 16:32:23 -0700
commit1b870ac0ca7d9e7a4de307fce480d915e69d3c6e (patch)
treec4088c311ab5b4734d1ab817f12434b1a419e5a9 /lib/ovs-thread.c
parentc2715e8d6354e4b1c7159fe69faa9ff2f31ee7db (diff)
downloadopenvswitch-1b870ac0ca7d9e7a4de307fce480d915e69d3c6e.tar.gz
lib: Remove extra API dependency for ovs_thread_create()
When calling ovs_thread_create() without calling fatal_signal_init() first, ovs_thread_create() some times asserts. This dependency is subtle and not very obvious. The root cause seems to be that, within ovs_thread_create(), the multi-threaded state is declared before all initializations are done. Signed-off-by: Andy Zhou <azhou@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'lib/ovs-thread.c')
-rw-r--r--lib/ovs-thread.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c
index eee8d9e45..aa0aab291 100644
--- a/lib/ovs-thread.c
+++ b/lib/ovs-thread.c
@@ -372,7 +372,6 @@ ovs_thread_create(const char *name, void *(*start)(void *), void *arg)
int error;
forbid_forking("multiple threads exist");
- multithreaded = true;
if (ovsthread_once_start(&once)) {
/* The first call to this function has to happen in the main thread.
@@ -389,6 +388,7 @@ ovs_thread_create(const char *name, void *(*start)(void *), void *arg)
ovsthread_once_done(&once);
}
+ multithreaded = true;
aux = xmalloc(sizeof *aux);
aux->start = start;
aux->arg = arg;