mirror of
https://github.com/Zygo/bees.git
synced 2025-05-17 21:35:45 +02:00
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 <bees@furryterror.org>
This commit is contained in:
parent
2f2a68be3d
commit
8bc90b743b
@ -172,9 +172,6 @@ namespace crucible {
|
|||||||
/// objects it holds, and exit its Task function.
|
/// objects it holds, and exit its Task function.
|
||||||
ExclusionLock try_lock(const Task &task);
|
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
|
/// Wrapper around pthread_setname_np which handles length limits
|
||||||
|
15
lib/task.cc
15
lib/task.cc
@ -936,21 +936,6 @@ namespace crucible {
|
|||||||
m_owner.reset();
|
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
|
ExclusionLock
|
||||||
Exclusion::try_lock(const Task &task)
|
Exclusion::try_lock(const Task &task)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user