gambit is hosted by Hepforge, IPPP Durham
GAMBIT  v1.5.0-252-gf9a3f78
a Global And Modular Bsm Inference Tool
Gambit::FunctorHelp Namespace Reference

Definitions of friend functions from above. More...

Functions

void entering_multithreaded_region (module_functor_common &functor)
 
void leaving_multithreaded_region (module_functor_common &functor)
 

Detailed Description

Definitions of friend functions from above.

Some helper functions for interacting with signals in the calculate() routine These don't exist in standalone compilations, are replaced with null functions

Function Documentation

◆ entering_multithreaded_region()

void Gambit::FunctorHelp::entering_multithreaded_region ( module_functor_common functor)

Definition at line 76 of file functors_with_signals.cpp.

References Gambit::SignalData::entering_multithreaded_region(), Gambit::module_functor_common::iCanManageLoops, Gambit::functor::myName, Gambit::SignalData::myrank(), Gambit::module_functor_common::signal_mode_locked, and Gambit::signaldata().

Referenced by Gambit::module_functor_common::entering_multithreaded_region().

77  {
78  if(functor.iCanManageLoops and not signaldata().inside_multithreaded_region())
79  {
80  /* Debugging */
81  if(omp_get_level()!=0)
82  {
83  std::cerr << "rank " << signaldata().myrank() <<": Tried to set signaldata().inside_omp_block=1 (in "<<functor.myName<<"), but we are already in a parellel region! Please file a bug report." << std::endl;
84  exit(EXIT_FAILURE);
85  } \
86  /* end debugging */
87  signaldata().entering_multithreaded_region(); /* Switch signal handler to threadsafe mode */
88  functor.signal_mode_locked = false; /* We are allowed to switch off sighandler threadsafe mode */
89  }
90  }
void entering_multithreaded_region()
Check if shutdown is in progress and raise appropriate termination exception if so.
EXPORT_SYMBOLS SignalData & signaldata()
Retrieve global instance of signal handler options struct.
std::string myrank()
Retrieve MPI rank as a string (for log messages etc.)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ leaving_multithreaded_region()

void Gambit::FunctorHelp::leaving_multithreaded_region ( module_functor_common functor)

Definition at line 92 of file functors_with_signals.cpp.

References Gambit::module_functor_common::iCanManageLoops, Gambit::SignalData::leaving_multithreaded_region(), Gambit::functor::myName, Gambit::SignalData::myrank(), Gambit::module_functor_common::signal_mode_locked, and Gambit::signaldata().

Referenced by Gambit::module_functor_common::leaving_multithreaded_region().

93  {
94  if(functor.iCanManageLoops and not functor.signal_mode_locked)
95  {
96  /* Debugging */
97  if(omp_get_level()!=0)
98  {
99  std::cerr << "rank " << signaldata().myrank() <<": Tried to set signaldata().inside_omp_block=0 (in "<<functor.myName<<"), but we are still inside a parellel region! Please file a bug report." << std::endl;
100  exit(EXIT_FAILURE);
101  }
102  /* end debugging */
103  signaldata().leaving_multithreaded_region(); /* Switch signal handler back to normal mode */
104  }
105  }
void leaving_multithreaded_region()
Exit threadsafe signal handling mode.
EXPORT_SYMBOLS SignalData & signaldata()
Retrieve global instance of signal handler options struct.
std::string myrank()
Retrieve MPI rank as a string (for log messages etc.)
Here is the call graph for this function:
Here is the caller graph for this function: