From 8c694539809564d8614cc49c3f77d7e28c82f80c Mon Sep 17 00:00:00 2001 From: Adam Mitz Date: Fri, 1 Sep 2023 18:29:58 -0500 Subject: [PATCH] Remove per-element locking in JobQueue --- dds/DCPS/JobQueue.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/dds/DCPS/JobQueue.cpp b/dds/DCPS/JobQueue.cpp index 546ae5fda1a..e765550e8b5 100644 --- a/dds/DCPS/JobQueue.cpp +++ b/dds/DCPS/JobQueue.cpp @@ -27,14 +27,16 @@ int JobQueue::handle_exception(ACE_HANDLE /*fd*/) Queue q; - ACE_Reverse_Lock rev_lock(mutex_); - ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, mutex_, -1); - q.swap(job_queue_); + { + ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, mutex_, -1); + q.swap(job_queue_); + } + for (Queue::const_iterator pos = q.begin(), limit = q.end(); pos != limit; ++pos) { - ACE_GUARD_RETURN(ACE_Reverse_Lock, rev_guard, rev_lock, -1); (*pos)->execute(); } + ACE_GUARD_RETURN(ACE_Thread_Mutex, guard, mutex_, -1); if (!job_queue_.empty()) { guard.release(); reactor()->notify(this);