From: Kshitij Bansal Date: Thu, 10 Jul 2014 20:20:42 +0000 (-0400) Subject: Merge remote-tracking branch 'origin/master' into segfaultfix X-Git-Tag: cvc5-1.0.0~6700^2 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=c30a3426c7c2cbaff88b5183b8d8c368a393ac4d;p=cvc5.git Merge remote-tracking branch 'origin/master' into segfaultfix --- c30a3426c7c2cbaff88b5183b8d8c368a393ac4d diff --cc src/main/portfolio.cpp index 8bfbeff7c,757b6cd3c..abe27eb06 --- a/src/main/portfolio.cpp +++ b/src/main/portfolio.cpp @@@ -74,21 -74,26 +75,35 @@@ std::pair runPortfolio(int numT for(int t = 0; t < numThreads; ++t) { + #if BOOST_HAS_THREAD_ATTR boost::thread::attributes attrs; - attrs.set_stack_size(256 * 1024 * 1024); - threads[t] = + if(stackSize > 0) { + attrs.set_stack_size(stackSize); + } + + threads[t] = boost::thread(attrs, boost::bind(runThread, t, threadFns[t], + boost::ref(threads_returnValue[t]) ) ); + #else /* BOOST_HAS_THREAD_ATTR */ + if(stackSize > 0) { + throw OptionException("cannot specify a stack size for worker threads; requires CVC4 to be built with Boost thread library >= 1.50.0"); + } + + threads[t] = + boost::thread(boost::bind(runThread, t, threadFns[t], boost::ref(threads_returnValue[t]) ) ); + + #endif /* BOOST_HAS_THREAD_ATTR */ + + if(Chat.isOn()) { + void *stackaddr; + size_t stacksize; + pthread_attr_t attr; + pthread_getattr_np(threads[t].native_handle(), &attr); + pthread_attr_getstack(&attr, &stackaddr, &stacksize); + Chat() << "Created worker thread " << t << " with stack size " << stacksize << std::endl; + } } if(not driverFn.empty())