From 8bc90b743b8b229fb71fb51455ee8ba7439122aa Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Sat, 11 Jan 2025 22:49:21 -0500 Subject: [PATCH] task: get rid of the `insert_task` method Nothing calls it (not even tests), and there's significant functional overlap with `try_lock`. Signed-off-by: Zygo Blaxell --- include/crucible/task.h | 3 --- lib/task.cc | 15 --------------- 2 files changed, 18 deletions(-) diff --git a/include/crucible/task.h b/include/crucible/task.h index 70dc3f2..81c8550 100644 --- a/include/crucible/task.h +++ b/include/crucible/task.h @@ -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 diff --git a/lib/task.cc b/lib/task.cc index e2b046d..35faaf5 100644 --- a/lib/task.cc +++ b/lib/task.cc @@ -936,21 +936,6 @@ namespace crucible { m_owner.reset(); } - void - Exclusion::insert_task(const Task &task) - { - unique_lock 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) {