added code to exit soon if requestExit() is called in mainThreadOneProc().
added code to finish the test immediately if the query of trigger fails.