Repository: trafficserver Updated Branches: refs/heads/master b00cb7bf1 -> 566194cc9
TS-3392 Fix static initialization order, for OSX Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/303010e9 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/303010e9 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/303010e9 Branch: refs/heads/master Commit: 303010e92627fe9561de780c1efbd8f01e3bdf44 Parents: b00cb7b Author: Bin Zeng <bz...@linkedin.com> Authored: Fri May 1 19:24:36 2015 -0600 Committer: Leif Hedstrom <zw...@apache.org> Committed: Fri May 1 19:24:36 2015 -0600 ---------------------------------------------------------------------- lib/ts/Arena.cc | 3 +++ lib/ts/ink_mutex.cc | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/303010e9/lib/ts/Arena.cc ---------------------------------------------------------------------- diff --git a/lib/ts/Arena.cc b/lib/ts/Arena.cc index 6ab9bdb..a67f2fe 100644 --- a/lib/ts/Arena.cc +++ b/lib/ts/Arena.cc @@ -21,6 +21,7 @@ limitations under the License. */ +#include "ink_mutex.h" #include "libts.h" #include <assert.h> #include <string.h> @@ -29,6 +30,8 @@ #define DEFAULT_ALLOC_SIZE 1024 #define DEFAULT_BLOCK_SIZE (DEFAULT_ALLOC_SIZE - (sizeof(ArenaBlock) - 8)) +// Define the _g_mattr first to avoid static initialization order fiasco. +x_pthread_mutexattr_t _g_mattr; static Allocator defaultSizeArenaBlock("ArenaBlock", DEFAULT_ALLOC_SIZE); http://git-wip-us.apache.org/repos/asf/trafficserver/blob/303010e9/lib/ts/ink_mutex.cc ---------------------------------------------------------------------- diff --git a/lib/ts/ink_mutex.cc b/lib/ts/ink_mutex.cc index 9036f55..98cc70a 100644 --- a/lib/ts/ink_mutex.cc +++ b/lib/ts/ink_mutex.cc @@ -27,6 +27,4 @@ #include "stdio.h" #include "ink_mutex.h" -x_pthread_mutexattr_t _g_mattr; - ink_mutex __global_death = PTHREAD_MUTEX_INITIALIZER;