Mirror von
https://github.com/tkuschel/bees.git
synchronisiert 2026-10-31 04:17:48 +01:00
task: don't hold the mutex while disposing of pending Tasks
In the event that someday Barrier allows users to force execution of its pending tasks prior to the destruction of the BarrierState object, we'll be ready to submit those Tasks for execution without waiting for the BarrierState mutex lock. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
Dieser Commit ist enthalten in:
1 Ursprung
2f25f89067
Commit
090fa39995
1 Datei geändert
+4
-2
+4
-2
@@ -791,11 +791,13 @@ namespace crucible {
|
||||
void
|
||||
BarrierState::release()
|
||||
{
|
||||
set<Task> tasks_local;
|
||||
unique_lock<mutex> lock(m_mutex);
|
||||
for (auto i : m_tasks) {
|
||||
swap(tasks_local, m_tasks);
|
||||
lock.unlock();
|
||||
for (const auto &i : tasks_local) {
|
||||
i.run();
|
||||
}
|
||||
m_tasks.clear();
|
||||
}
|
||||
|
||||
BarrierState::~BarrierState()
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren