ovs_threads: Avoid running pthread destructors from main thread exit.
authorGurucharan Shetty <gshetty@nicira.com>
Wed, 8 Apr 2015 00:34:27 +0000 (17:34 -0700)
committerGurucharan Shetty <gshetty@nicira.com>
Wed, 27 May 2015 16:43:36 +0000 (09:43 -0700)
commitd2843eba6d939526eb3daef511099bed2d18dd2c
treee68caf5c7729c39f52ecd5312ca4b541b4900018
parent3b4099b496acadbb47818b60a1343f819ae36be2
ovs_threads: Avoid running pthread destructors from main thread exit.

Windows uses pthreads-win32 library to provide the Linux pthread
functionality. It is observed that when the main thread calls
a pthread destructor after it exits, undefined behavior is seen
(e.g., junk values in data, causing pthread deadlocks).
Similar behavior has been seen by
other people as seen in the following email thread:
https://sourceware.org/ml/pthreads-win32/2003/msg00001.html

To avoid this, this commit de-registers the thread destructor
when the main thread exits (via the atexit handler).

Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
Acked-by: Ben Pfaff <blp@nicira.com>
lib/ovs-rcu.c
lib/ovs-thread.c
tests/test-atomic.c