OpenDDS  Snapshot(2023/04/28-20:55)
JobQueue.cpp
Go to the documentation of this file.
1 /*
2  *
3  *
4  * Distributed under the OpenDDS License.
5  * See: http://www.opendds.org/license.html
6  */
7 
8 #include <DCPS/DdsDcps_pch.h> // Only the _pch include should start with DCPS/
9 
10 #include "JobQueue.h"
11 
12 #include "Service_Participant.h"
13 
15 
16 namespace OpenDDS {
17 namespace DCPS {
18 
20 {
21  this->reactor(reactor);
22 }
23 
24 int JobQueue::handle_exception(ACE_HANDLE /*fd*/)
25 {
26  ThreadStatusManager::Event ev(TheServiceParticipant->get_thread_status_manager());
27 
28  Queue q;
29 
32  q.swap(job_queue_);
33  for (Queue::const_iterator pos = q.begin(), limit = q.end(); pos != limit; ++pos) {
34  ACE_GUARD_RETURN(ACE_Reverse_Lock<ACE_Thread_Mutex>, rev_guard, rev_lock, -1);
35  (*pos)->execute();
36  }
37 
38  if (!job_queue_.empty()) {
39  guard.release();
40  reactor()->notify(this);
41  }
42 
43  return 0;
44 }
45 
46 } // namespace DCPS
47 } // namespace OpenDDS
48 
JobQueue(ACE_Reactor *reactor)
Definition: JobQueue.cpp:19
int notify(ACE_Event_Handler *event_handler=0, ACE_Reactor_Mask masks=ACE_Event_Handler::EXCEPT_MASK, ACE_Time_Value *timeout=0)
int handle_exception(ACE_HANDLE)
Definition: JobQueue.cpp:24
#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN)
virtual ACE_Reactor * reactor(void) const
#define OPENDDS_END_VERSIONED_NAMESPACE_DECL
ACE_Thread_Mutex mutex_
Definition: JobQueue.h:73
#define TheServiceParticipant
The Internal API and Implementation of OpenDDS.
Definition: AddressCache.h:28