]> git.hungrycats.org Git - bees/commitdiff
task: get rid of the `insert_task` method
authorZygo Blaxell <bees@furryterror.org>
Sun, 12 Jan 2025 03:49:21 +0000 (22:49 -0500)
committerZygo Blaxell <bees@furryterror.org>
Sun, 12 Jan 2025 04:39:55 +0000 (23:39 -0500)
Nothing calls it (not even tests), and there's significant functional
overlap with `try_lock`.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
include/crucible/task.h
lib/task.cc

index 70dc3f23245d963d3fe3223834b1c872410f1cd5..81c8550db8130d526bed6989f010da7c36cf5796 100644 (file)
@@ -172,9 +172,6 @@ namespace crucible {
                /// objects it holds, and exit its Task function.
                ExclusionLock try_lock(const Task &task);
 
-               /// Execute Task when Exclusion is unlocked (possibly
-               /// immediately).
-               void insert_task(const Task &t);
        };
 
        /// Wrapper around pthread_setname_np which handles length limits
index e2b046d304a258508878e2fdd17aabde80440a22..35faaf55faedcddc85aa75a6113ae4f071f41f29 100644 (file)
@@ -936,21 +936,6 @@ namespace crucible {
                m_owner.reset();
        }
 
-       void
-       Exclusion::insert_task(const Task &task)
-       {
-               unique_lock<mutex> lock(m_mutex);
-               const auto sp = m_owner.lock();
-               lock.unlock();
-               if (sp) {
-                       // If Exclusion is locked then queue task for release;
-                       sp->append(task);
-               } else {
-                       // otherwise, run the inserted task immediately
-                       task.run();
-               }
-       }
-
        ExclusionLock
        Exclusion::try_lock(const Task &task)
        {