GemaCoreLib
The GeMA Core library
Macros
gmSimulationDataCancelCheck.h File Reference

Declaration of the GmSimulationDataCheckForCancelation macro. More...

#include "gmSimulationData.h"
#include <luaEnv.h>
Include dependency graph for gmSimulationDataCancelCheck.h:

Go to the source code of this file.

Macros

#define GmSimulationDataCheckForCancelation(simData, msg)
 Macro for checking for a cancelation request, from the main thread, and generating a Lua Error in that case. More...
 

Detailed Description

Declaration of the GmSimulationDataCheckForCancelation macro.

Author
Carlos Augusto Teixeira Mendes
Date
march, 2015

Macro Definition Documentation

◆ GmSimulationDataCheckForCancelation

#define GmSimulationDataCheckForCancelation (   simData,
  msg 
)
Value:
do \
{ \
if((simData)->cancelRequested()) \
{ \
luaL_error((simData)->threadManager()->threadLuaEnv(0)->state(), "%s", luaPrintable(msg)); \
} \
} while(0)
static bool inMainThread()
Is the current thread the main thread? Equivalent to comparing the currentId() with 0.
Definition: gmThreadManager.h:169

Macro for checking for a cancelation request, from the main thread, and generating a Lua Error in that case.

Implemented as a macro to make sure that the message is NOT constructed unless a cancelation is in order. The do ... while(0) idiom makes sure that it can be used inside an if() with an ending ;