Do not call exit_threads() in Application d'tor

Because exit_threads() references the global object TM, we
need to call the function when still inside main(), otherwise,
due to undefined global object initialization and destruction
we could end up with referencing an already destroyed object.

Actually this should not happen because Application singleton
is initialized _only_ after all the other globals due to how
Application::initialize() is defined, but this is very tricky
C++ and not easy to follow, even for me ;-)

Also rearranged a bit main() code flow.

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba
2010-04-25 10:31:48 +01:00
parent e6b5d03cc4
commit fb0e19dc8b
4 changed files with 28 additions and 24 deletions

View File

@@ -382,7 +382,7 @@ Value do_evaluate(const Position& pos, EvalInfo& ei, int threadID) {
// Middle-game specific evaluation terms
if (phase > PHASE_ENDGAME)
{
// Pawn storms in positions with opposite castling.
// Pawn storms in positions with opposite castling
if ( square_file(pos.king_square(WHITE)) >= FILE_E
&& square_file(pos.king_square(BLACK)) <= FILE_D)