]> git.sesse.net Git - stockfish/commit
Do not call exit_threads() in Application d'tor
authorMarco Costalba <mcostalba@gmail.com>
Sun, 25 Apr 2010 09:31:48 +0000 (10:31 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Sun, 25 Apr 2010 09:35:55 +0000 (10:35 +0100)
commitfb0e19dc8bcd770db4f627b90697f29965151429
treeb28d5802db835bc9bc81ad75aba5e2be4acc00cd
parente6b5d03cc4bdc95cc50537b5fb25ffa31787041b
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>
src/application.cpp
src/application.h
src/evaluate.cpp
src/main.cpp