]> feistymeow.org Git - feisty_meow.git/commitdiff
tastier from perspective of wild threads
authorFred T. Hamster <fred@feistymeow.org>
Tue, 17 Feb 2026 15:10:41 +0000 (10:10 -0500)
committerFred T. Hamster <fred@feistymeow.org>
Tue, 17 Feb 2026 15:10:41 +0000 (10:10 -0500)
we want the activity on the threads to be as intermingled as possible, so i moved the logging after the action of adding or deleting.
this makes sure that they're queueing up on the logging mutex *after* they've done their work on the bin, so any thread issues from multiple simultaneous bin accesses should not be hidden by the logging synchronization anymore.

octopi/library/tests_octopus/test_bin_threaded.cpp

index a83c83152be0a786fccbb52796b6aa2bcf67db5b..b33cbae936dbed1afa80253d0b30328c4e4f4494 100644 (file)
@@ -221,8 +221,8 @@ public:
       if (!__threads_can_run_wild_and_free()) { sleep_time(MIN_ADDER_THREAD_PAUSE); return; }
       unhandled_request *newbert = new unhandled_request(create_request_id(),
           random_strings);
-      BASE_LOG("+");
       binger.add_item(newbert, create_request_id());
+      BASE_LOG("+");
     }
 
     // snooze.
@@ -265,8 +265,8 @@ public:
       octopus_request_id id;
       infoton *found = binger.acquire_for_any(id);
       if (!found) break;  // nothing to whack there.
-      BASE_LOG("-");
       WHACK(found);
+      BASE_LOG("-");
     }
     // snooze.
     int sleepy_time = randomizer().inclusive(MIN_WHACKER_THREAD_PAUSE,
@@ -343,8 +343,8 @@ LOG(a_sprintf("monk sees %d items and will clean them all.", binger.items_held()
       infoton *found = binger.acquire_for_any(id);
       if (!found) break;  // nothing to see here.
       check_count++;
-      BASE_LOG("-");
       WHACK(found);
+      BASE_LOG("-");
       // also clean out things a lot faster than normal.  
       binger.clean_out_deadwood(MONKS_CLEANING_TIME);
 //hmmm: interesting--deadwood cleaning above will possibly cause us not to clean out the number of items reported above for items_held().