Skip to content

Commit

Permalink
Merge pull request OpenDDS#4253 from mitza-oci/jobqueue
Browse files Browse the repository at this point in the history
Remove per-element locking in JobQueue
  • Loading branch information
jrw972 authored Sep 6, 2023
2 parents 4e82122 + 8c69453 commit eb31c05
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions dds/DCPS/JobQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,16 @@ int JobQueue::handle_exception(ACE_HANDLE /*fd*/)

Queue q;

ACE_Reverse_Lock<ACE_Thread_Mutex> 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<ACE_Thread_Mutex>, 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);
Expand Down

0 comments on commit eb31c05

Please sign in to comment.