diff options
author | Andrew Morrow <acm@mongodb.com> | 2017-02-26 15:15:08 -0500 |
---|---|---|
committer | Andrew Morrow <acm@mongodb.com> | 2017-08-02 23:29:55 -0400 |
commit | a8a1ea3b9367adb6d0b65a7da21fed89598ea093 (patch) | |
tree | 8e969ed54b88c2a9c4c2d45a6518d053ac9f4265 /SConstruct | |
parent | c02c14e30d75b02894da116f4bb1a71652ead2b4 (diff) | |
download | mongo-a8a1ea3b9367adb6d0b65a7da21fed89598ea093.tar.gz |
SERVER-26538 SERVER-26539 Detach from boost::thread
Also, use thread_local everywhere for our thread specific data needs
and remove the legacy support.
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 44 |
1 files changed, 8 insertions, 36 deletions
diff --git a/SConstruct b/SConstruct index 7353ea36c84..5dbc05a3be8 100644 --- a/SConstruct +++ b/SConstruct @@ -806,7 +806,7 @@ def printLocalInfo(): printLocalInfo() -boostLibs = [ "thread", "filesystem", "program_options", "system", "iostreams" ] +boostLibs = [ "filesystem", "program_options", "system", "iostreams" ] onlyServer = len( COMMAND_LINE_TARGETS ) == 0 or ( len( COMMAND_LINE_TARGETS ) == 1 and str( COMMAND_LINE_TARGETS[0] ) in [ "mongod" , "mongos" , "test" ] ) @@ -2508,33 +2508,24 @@ def doConfigure(myenv): if not myenv.ToolchainIs('msvc'): AddToCCFLAGSIfSupported(myenv, "-fno-builtin-memcmp") - def CheckStorageClass(context, storage_class): + def CheckThreadLocal(context): test_body = """ - {0} int tsp_int = 1; + thread_local int tsp_int = 1; int main(int argc, char** argv) {{ return !(tsp_int == argc); }} - """.format(storage_class) - context.Message('Checking for storage class {0} '.format(storage_class)) + """ + context.Message('Checking for storage class thread_local ') ret = context.TryLink(textwrap.dedent(test_body), ".cpp") context.Result(ret) return ret conf = Configure(myenv, help=False, custom_tests = { - 'CheckStorageClass': CheckStorageClass + 'CheckThreadLocal': CheckThreadLocal }) - haveTriviallyConstructibleThreadLocals = False - for storage_class, macro_name in [ - ('thread_local', 'MONGO_CONFIG_HAVE_THREAD_LOCAL'), - ('__thread', 'MONGO_CONFIG_HAVE___THREAD'), - ('__declspec(thread)', 'MONGO_CONFIG_HAVE___DECLSPEC_THREAD')]: - if conf.CheckStorageClass(storage_class): - haveTriviallyConstructibleThreadLocals = True - myenv.SetConfigHeaderDefine(macro_name) + if not conf.CheckThreadLocal(): + env.ConfError("Compiler must support the thread_local storage class") conf.Finish() - if not haveTriviallyConstructibleThreadLocals: - env.ConfError("Compiler must support a thread local storage class for trivially constructible types") - def CheckCXX14EnableIfT(context): test_body = """ @@ -2811,10 +2802,6 @@ def doConfigure(myenv): conf.env.Append( CPPDEFINES=[ - ("BOOST_THREAD_VERSION", "4"), - # Boost thread v4's variadic thread support doesn't - # permit more than four parameters. - "BOOST_THREAD_DONT_PROVIDE_VARIADIC_THREAD", "BOOST_SYSTEM_NO_DEPRECATED", "BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS", ] @@ -2838,21 +2825,6 @@ def doConfigure(myenv): boostlib, [boostlib + suffix for suffix in boostSuffixList], language='C++') - else: - # For the built in boost, we can set these without risking ODR violations, so do so. - conf.env.Append( - CPPDEFINES=[ - # We don't want interruptions because we don't use - # them and they have a performance cost. - "BOOST_THREAD_DONT_PROVIDE_INTERRUPTIONS", - - # We believe that none of our platforms are affected - # by the EINTR bug. Setting this avoids a retry loop - # in boosts mutex.hpp that we don't want to pay for. - "BOOST_THREAD_HAS_NO_EINTR_BUG", - ], - ) - if posix_system: conf.env.SetConfigHeaderDefine("MONGO_CONFIG_HAVE_HEADER_UNISTD_H") conf.CheckLib('rt') |