From: Fred T. Hamster Date: Tue, 17 Feb 2026 13:49:55 +0000 (-0500) Subject: issues seem solved re pure virtual function call X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=b43d45c78363fcd7f44889b40a5ad009f896dbbf;p=feisty_meow.git issues seem solved re pure virtual function call threaded shutdown seems to be much healthier when all the threads are given a cancel order first. this doesn't make anything stop or pause, and we zoom through the list cancelling them all. they're then free to exit at will. and when we start waiting for them in the amorph reset, they're mostly already done, so the shutdown is pretty much all threads down in parallel, instead of the sequential shutdown we had been doing (which was also fraught with potential error, apparently, from inconsistent ordering of thread shutdowns and object shutdowns and such). --- diff --git a/octopi/library/tests_octopus/test_bin_threaded.cpp b/octopi/library/tests_octopus/test_bin_threaded.cpp index d033df23..a83c8315 100644 --- a/octopi/library/tests_octopus/test_bin_threaded.cpp +++ b/octopi/library/tests_octopus/test_bin_threaded.cpp @@ -14,10 +14,10 @@ #include #include +#include #include #include #include -#include #include #include #include @@ -52,6 +52,8 @@ using namespace textual; using namespace timely; using namespace unit_test; +////////////// + // synchronization for logged messages to avoid overwriting on the console. SAFE_STATIC(mutex, __loggers_lock, ) @@ -61,6 +63,8 @@ SAFE_STATIC(mutex, __loggers_lock, ) CLASS_EMERGENCY_LOG(program_wide_logger::get(), astring(s)); \ } +////////////// + // the base log feature just prints the text to the console with no carriage return or extra flair. // it does count up how many characters have been printed though, and does an EOL when it seems like it would be reasonable (80 chars-ish). // note that this code makes no attempt to worry about any other printing that's happening; it has a very egocentric view of what's on the @@ -84,6 +88,8 @@ SAFE_STATIC(console_logger, ted, ); } //hmmm: may want to make the line size selectable, if we keep some version of the above line handling code around. +////////////// + // protects our logging stream really, by keeping all the threads chomping at the bit rather // than running right away. when this flag switches to true, then *bam* they're off. class bool_scared_ya : public root_object { @@ -99,6 +105,8 @@ private: }; SAFE_STATIC(bool_scared_ya, __threads_can_run_wild_and_free, (false)); +////////////// + // global constants... //const int DEFAULT_RUN_TIME = 80 * MINUTE_ms; @@ -141,6 +149,8 @@ const int DATA_DECAY_TIME = 1 * MINUTE_ms; const int MONKS_CLEANING_TIME = 10 * SECOND_ms; // a very short duration for data to live. +////////////// + // global objects... SAFE_STATIC(chaos, _rando, ); @@ -150,6 +160,8 @@ SAFE_STATIC(chaos, _rando, ); entity_data_bin binger(MAXIMUM_DATA_PER_ENTITY); +////////////// + octopus_request_id create_request_id() { // test the basic filling of the values in an entity. @@ -173,6 +185,8 @@ octopus_request_id create_request_id() return req_id; } +////////////// + // this thread creates new items for the entity data bin. // also known as the adder. class ballot_box_stuffer : public ethread @@ -263,6 +277,8 @@ public: } }; +////////////// + // this class makes sure the deadwood is cleaned out of the entity bin. class obsessive_compulsive : public ethread { @@ -292,6 +308,8 @@ public: } }; +////////////// + // this thread will destroy all data in the bins while cleaning furiously. class monk_the_detective : public ethread { @@ -424,5 +442,7 @@ int test_entity_data_bin_threaded::execute() return 0; } +////////////// + HOOPLE_MAIN(test_entity_data_bin_threaded, )