if (aret) LOG("failed to set detach state.");
int ret = -1;
if (_periodic)
- ret = pthread_create(_handle, &attribs, periodic_thread_driver,
- (void *)this);
+ ret = pthread_create(_handle, &attribs, periodic_thread_driver, (void *)this);
else
- ret = pthread_create(_handle, &attribs, one_shot_thread_driver,
- (void *)this);
+ ret = pthread_create(_handle, &attribs, one_shot_thread_driver, (void *)this);
if (!ret) success = true;
else error = ret;
/*
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, )
public:
obsessive_compulsive() : ethread(MIN_TIDIER_THREAD_PAUSE, ethread::TIGHT_INTERVAL) {
FUNCDEF("constructor");
- LOG("<< new cleaner <<");
+ LOG(">> new cleaner >>");
}
virtual ~obsessive_compulsive() {
FUNCDEF("destructor");
- LOG(">> cleaner exits >>");
+ LOG("<< cleaner exits <<");
}
DEFINE_CLASS_NAME("obsessive_compulsive");
__threads_can_run_wild_and_free() = false;
-#ifdef FANCY_UNNECESSARY_THREAD_STOP
- //hmmm: this code shouldn't be needed! thread cabinet should do it!!!!
+//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.
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
# methods with a way to know how they were invoked. to get this information.
# the invoker must be fitted with FUNCDEF macros.
ifeq "$(BOOT_STRAPPING)" ""
- DEFINITIONS += ENABLE_CALLSTACK_TRACKING
+# DEFINITIONS += ENABLE_CALLSTACK_TRACKING
endif