Merge pull request #681 from dr-robertk/PR/use_have_pthread

Use HAVE_PTHREAD to enable async output.
This commit is contained in:
Atgeirr Flø Rasmussen 2016-05-12 12:20:09 +02:00
commit ca40a31e7b

View File

@ -302,12 +302,6 @@ namespace Opm
eclipseState_(eclipseState),
asyncOutput_()
{
// create output thread if needed
if( output_ && param.getDefault("async_output", bool( false ) ) )
{
asyncOutput_.reset( new ThreadHandle() );
}
// For output.
if (output_ && parallelOutput_->isIORank() ) {
// Ensure that output dir exists
@ -319,6 +313,22 @@ namespace Opm
OPM_THROW(std::runtime_error, "Creating directories failed: " << fpath);
}
// create output thread if enabled and rank is I/O rank
// async output is enabled by default if pthread are enabled
#if HAVE_PTHREAD
const bool asyncOutputDefault = true;
#else
const bool asyncOutputDefault = false;
#endif
if( param.getDefault("async_output", asyncOutputDefault ) )
{
#if HAVE_PTHREAD
asyncOutput_.reset( new ThreadHandle() );
#else
OPM_THROW(std::runtime_error,"Pthreads were not found, cannot enable async_output");
#endif
}
std::string backupfilename = param.getDefault("backupfile", std::string("") );
if( ! backupfilename.empty() )
{