using namespace timely;
using namespace unit_test;
-// uncomment if you want the more careful shutdown of the threads.
-//#define FANCY_UNNECESSARY_THREAD_STOP ugh
-
// synchronization for logged messages to avoid overwriting on the console.
SAFE_STATIC(mutex, __loggers_lock, )
__threads_can_run_wild_and_free() = false;
-//deciding whether the cancel really should be done every time, to let the threads bail on their own rather than single stepping through their shutdowns.
+ /* we cancel all the threads first. this gives them an opportunity to know
+ they should shut down, and they will all go about that at their own rate. if we
+ just killed the list with reset first, then the amorph would dutifully shut the
+ threads down also, but it would do them sequentially which is way slower. */
LOG("now cancelling all threads...");
for (int j = 0; j < thread_list.elements(); j++) { thread_list[j]->cancel(); }
-
-#ifdef FANCY_UNNECESSARY_THREAD_STOP
- //hmmm: this code shouldn't be needed! thread cabinet should do it!!!!
- LOG("now stopping all threads...");
- for (int k = 0; k < thread_list.elements(); k++) { thread_list[k]->stop(); }
-#endif
-
LOG("now resetting thread list...");
thread_list.reset(); // should whack all threads.
LOG("...done exiting from all threads.");