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 <az...@ovn.org> --- lib/ovs-thread.c | 2 +- tests/test-rcu.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/ovs-thread.c b/lib/ovs-thread.c index 6e63452..c7dc7da 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; diff --git a/tests/test-rcu.c b/tests/test-rcu.c index e66367e..965f3c4 100644 --- a/tests/test-rcu.c +++ b/tests/test-rcu.c @@ -39,7 +39,6 @@ test_rcu_quiesce(int argc OVS_UNUSED, char *argv[] OVS_UNUSED) { pthread_t quiescer; - fatal_signal_init(); quiescer = ovs_thread_create("quiescer", quiescer_main, NULL); /* This is the main thread of the process. After spawning its first -- 1.9.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev