Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

SgSystem.cpp File Reference


Detailed Description

See SgSystem.h.

Definition in file SgSystem.cpp.

#include "SgSystem.h"
#include <algorithm>
#include <cassert>
#include <cstdlib>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include "SgTime.h"

Go to the source code of this file.

Functions

list< SgAssertionHandler * > & AssertionHandlers ()
 Assertion handlers.
void SgHandleAssertion (const char *expr, const char *file, int line)
 System-specific action when an SG_ASSERT fails.
void SgSetUserAbort (bool aborted)
 Sets the global user abort flag.
bool SgUserAbort ()
 Poll for user abort.

Variables

volatile bool s_userAbort = false
static bool s_assertContinue = std::getenv("SMARTGAME_ASSERT_CONTINUE")
 Set the shell variable SMARTGAME_ASSERT_CONTINUE to drop into the debugger instead of aborting the program whenever an SG_ASSERT fails.


Function Documentation

list<SgAssertionHandler*>& @9::AssertionHandlers (  )  [static]

Assertion handlers.

Stored in a static function variable to ensure, that they exist at first usage, if this function is called from global variables in different compilation units.

Definition at line 31 of file SgSystem.cpp.

Referenced by SgAssertionHandler::SgAssertionHandler(), SgHandleAssertion(), and SgAssertionHandler::~SgAssertionHandler().

void SgHandleAssertion ( const char *  expr,
const char *  file,
int  line 
)

System-specific action when an SG_ASSERT fails.

Set a breakpoint on the next line to drop into the debugger

Definition at line 60 of file SgSystem.cpp.

References AssertionHandlers(), SgAssertionHandler::Run(), and s_assertContinue.

void SgSetUserAbort ( bool  aborted  ) 

Sets the global user abort flag.

This flag should be set to false at the beginning of each user event, e.g. each GUI event or GTP command. Lengthy functions should poll the user abort flag with SgUserAbort and abort, if necessary; they should not reset the flag themselves. It can also be called from a different thread (the abort flag is declared volatile).

Definition at line 74 of file SgSystem.cpp.

References s_userAbort.

bool SgUserAbort (  ) 

Poll for user abort.

See also:
SgSetUserAbort.

Definition at line 79 of file SgSystem.cpp.

References s_userAbort.

Referenced by SgSearch::AbortSearch(), SgUctSearch::CheckAbortSearch(), SgUctTree::CopySubtree(), and SgUctSearch::SearchOnePly().


Variable Documentation

bool s_assertContinue = std::getenv("SMARTGAME_ASSERT_CONTINUE") [static]

Set the shell variable SMARTGAME_ASSERT_CONTINUE to drop into the debugger instead of aborting the program whenever an SG_ASSERT fails.

Definition at line 58 of file SgSystem.cpp.

Referenced by SgHandleAssertion().

volatile bool s_userAbort = false [static]

Definition at line 24 of file SgSystem.cpp.

Referenced by SgSetUserAbort(), and SgUserAbort().


17 Jun 2010 Doxygen 1.4.7