[bugfix] Only create asyncOutput when output is enabled globally.

This commit is contained in:
Robert Kloefkorn 2017-06-02 13:07:44 +02:00
parent 9a32e2baca
commit 46f66e34b9

View File

@ -378,24 +378,24 @@ namespace Opm
backupfile_.open( backupfilename.c_str() ); backupfile_.open( backupfilename.c_str() );
} }
} }
}
// create output thread if enabled and rank is I/O rank // create output thread if enabled and rank is I/O rank
// async output is enabled by default if pthread are enabled // async output is enabled by default if pthread are enabled
#if HAVE_PTHREAD #if HAVE_PTHREAD
const bool asyncOutputDefault = true; const bool asyncOutputDefault = true;
#else #else
const bool asyncOutputDefault = false; const bool asyncOutputDefault = false;
#endif #endif
if( param.getDefault("async_output", asyncOutputDefault ) ) if( param.getDefault("async_output", asyncOutputDefault ) )
{ {
const bool isIORank = parallelOutput_ ? parallelOutput_->isIORank() : true;
#if HAVE_PTHREAD #if HAVE_PTHREAD
asyncOutput_.reset( new ThreadHandle( parallelOutput_->isIORank() ) ); asyncOutput_.reset( new ThreadHandle( isIORank ) );
#else #else
OPM_THROW(std::runtime_error,"Pthreads were not found, cannot enable async_output"); OPM_THROW(std::runtime_error,"Pthreads were not found, cannot enable async_output");
#endif #endif
}
} }
} }