2 #include "ace/Handle_Set.h"
3 #include "ace/Reactor.h"
4 #include "ace/Thread.h"
5 #include "ace/Sig_Handler.h"
6 #include "ace/OS_NS_errno.h"
8 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
10 /************************************************************/
13 ACE_Wakeup_All_Threads_Handler::handle_signal (int /* signum */, siginfo_t * /* siginfo */, ucontext_t *)
15 // This will get called when <WFMO_Reactor->wakeup_all_threads_> event
16 // is signaled. There is nothing to be done here.
17 // ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) waking up to get updated handle set info\n")));
21 #if defined (ACE_WIN32)
23 /************************************************************/
26 ACE_WFMO_Reactor_Handler_Repository::Common_Info::Common_Info ()
29 io_handle_ (ACE_INVALID_HANDLE),
31 delete_event_ (false),
32 delete_entry_ (false),
33 close_masks_ (ACE_Event_Handler::NULL_MASK)
38 ACE_WFMO_Reactor_Handler_Repository::Common_Info::reset ()
40 this->event_handler_ = 0;
41 this->io_entry_ = false;
42 this->io_handle_ = ACE_INVALID_HANDLE;
43 this->network_events_ = 0;
44 this->delete_event_ = false;
45 this->delete_entry_ = false;
46 this->close_masks_ = ACE_Event_Handler::NULL_MASK;
50 ACE_WFMO_Reactor_Handler_Repository::Common_Info::set (bool io_entry,
51 ACE_Event_Handler *event_handler,
56 ACE_Reactor_Mask close_masks)
58 this->event_handler_ = event_handler;
59 this->io_entry_ = io_entry;
60 this->io_handle_ = io_handle;
61 this->network_events_ = network_events;
62 this->delete_event_ = delete_event;
63 this->delete_entry_ = delete_entry;
64 this->close_masks_ = close_masks;
68 ACE_WFMO_Reactor_Handler_Repository::Common_Info::set (Common_Info &common_info)
74 ACE_WFMO_Reactor_Handler_Repository::Common_Info::dump () const
76 #if defined (ACE_HAS_DUMP)
77 ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Common_Info::dump");
79 ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
81 ACELIB_DEBUG ((LM_DEBUG,
82 ACE_TEXT ("I/O Entry = %d\n"),
85 ACELIB_DEBUG ((LM_DEBUG,
86 ACE_TEXT ("Event Handler = %d\n"),
87 this->event_handler_));
89 ACELIB_DEBUG ((LM_DEBUG,
90 ACE_TEXT ("I/O Handle = %d\n"),
93 ACELIB_DEBUG ((LM_DEBUG,
94 ACE_TEXT ("Network Events = %d\n"),
95 this->network_events_));
97 ACELIB_DEBUG ((LM_DEBUG,
98 ACE_TEXT ("Delete Event = %d\n"),
99 this->delete_event_));
101 ACELIB_DEBUG ((LM_DEBUG,
102 ACE_TEXT ("Delete Entry = %d\n"),
103 this->delete_entry_));
105 ACELIB_DEBUG ((LM_DEBUG,
106 ACE_TEXT ("Close Masks = %d\n"),
107 this->close_masks_));
109 ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
110 #endif /* ACE_HAS_DUMP */
113 /************************************************************/
116 ACE_WFMO_Reactor_Handler_Repository::Current_Info::Current_Info ()
117 : suspend_entry_ (false)
122 ACE_WFMO_Reactor_Handler_Repository::Current_Info::set (bool io_entry,
123 ACE_Event_Handler *event_handler,
124 ACE_HANDLE io_handle,
128 ACE_Reactor_Mask close_masks,
131 this->suspend_entry_ = suspend_entry;
132 Common_Info::set (io_entry,
142 ACE_WFMO_Reactor_Handler_Repository::Current_Info::set (Common_Info &common_info,
145 this->suspend_entry_ = suspend_entry;
146 Common_Info::set (common_info);
150 ACE_WFMO_Reactor_Handler_Repository::Current_Info::reset ()
152 this->suspend_entry_ = false;
153 Common_Info::reset ();
157 ACE_WFMO_Reactor_Handler_Repository::Current_Info::dump (ACE_HANDLE event_handle) const
159 #if defined (ACE_HAS_DUMP)
160 ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Current_Info::dump");
162 ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
164 Common_Info::dump ();
166 ACELIB_DEBUG ((LM_DEBUG,
167 ACE_TEXT ("Event Handle = %d\n"),
170 ACELIB_DEBUG ((LM_DEBUG,
171 ACE_TEXT ("Suspend Entry = %d\n"),
172 this->suspend_entry_));
174 ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
175 #else /* !ACE_HAS_DUMP */
176 ACE_UNUSED_ARG (event_handle);
177 #endif /* ACE_HAS_DUMP */
180 /************************************************************/
183 ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::To_Be_Added_Info ()
184 : event_handle_ (ACE_INVALID_HANDLE),
185 suspend_entry_ (false)
190 ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::set (ACE_HANDLE event_handle,
192 ACE_Event_Handler *event_handler,
193 ACE_HANDLE io_handle,
197 ACE_Reactor_Mask close_masks,
200 this->event_handle_ = event_handle;
201 this->suspend_entry_ = suspend_entry;
202 Common_Info::set (io_entry,
212 ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::set (ACE_HANDLE event_handle,
213 Common_Info &common_info,
216 this->event_handle_ = event_handle;
217 this->suspend_entry_ = suspend_entry;
218 Common_Info::set (common_info);
222 ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::reset ()
224 this->event_handle_ = ACE_INVALID_HANDLE;
225 this->suspend_entry_ = false;
226 Common_Info::reset ();
230 ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::dump () const
232 #if defined (ACE_HAS_DUMP)
233 ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::To_Be_Added_Info::dump");
235 ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
237 Common_Info::dump ();
239 ACELIB_DEBUG ((LM_DEBUG,
240 ACE_TEXT ("Event Handle = %d\n"),
241 this->event_handle_));
243 ACELIB_DEBUG ((LM_DEBUG,
244 ACE_TEXT ("Suspend Entry = %d\n"),
245 this->suspend_entry_));
247 ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
248 #endif /* ACE_HAS_DUMP */
251 /************************************************************/
254 ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::Suspended_Info ()
255 : event_handle_ (ACE_INVALID_HANDLE),
256 resume_entry_ (false)
261 ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::reset ()
263 this->event_handle_ = ACE_INVALID_HANDLE;
264 this->resume_entry_ = false;
265 Common_Info::reset ();
269 ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::set (ACE_HANDLE event_handle,
271 ACE_Event_Handler *event_handler,
272 ACE_HANDLE io_handle,
276 ACE_Reactor_Mask close_masks,
279 this->event_handle_ = event_handle;
280 this->resume_entry_ = resume_entry;
281 Common_Info::set (io_entry,
291 ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::set (ACE_HANDLE event_handle,
292 Common_Info &common_info,
295 this->event_handle_ = event_handle;
296 this->resume_entry_ = resume_entry;
297 Common_Info::set (common_info);
301 ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::dump () const
303 #if defined (ACE_HAS_DUMP)
304 ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::Suspended_Info::dump");
306 ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
308 Common_Info::dump ();
310 ACELIB_DEBUG ((LM_DEBUG,
311 ACE_TEXT ("Event Handle = %d\n"),
312 this->event_handle_));
314 ACELIB_DEBUG ((LM_DEBUG,
315 ACE_TEXT ("Resume Entry = %d\n"),
316 this->resume_entry_));
318 ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
319 #endif /* ACE_HAS_DUMP */
322 /************************************************************/
325 ACE_WFMO_Reactor_Handler_Repository::close ()
327 // Let all the handlers know that the <WFMO_Reactor> is closing down
333 ACE_INLINE ACE_HANDLE *
334 ACE_WFMO_Reactor_Handler_Repository::handles () const
336 // This code is probably too subtle to be useful in the long run...
337 // The basic idea is that all threads wait on all user handles plus
338 // the <wakeup_all_threads_> handle. The owner thread additional
339 // waits on the <notify_> handle. This is to ensure that only the
340 // <owner_> thread get to expire timers and handle event on the
342 if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ())
343 return this->current_handles_;
345 return this->current_handles_ + 1;
348 ACE_INLINE ACE_WFMO_Reactor_Handler_Repository::Current_Info *
349 ACE_WFMO_Reactor_Handler_Repository::current_info () const
351 if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ())
352 return this->current_info_;
354 return this->current_info_ + 1;
358 ACE_WFMO_Reactor_Handler_Repository::max_handlep1 () const
360 if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ())
361 return this->max_handlep1_;
363 return this->max_handlep1_ - 1;
367 ACE_WFMO_Reactor_Handler_Repository::scheduled_for_deletion (size_t slot) const
369 if (ACE_Thread::self () == this->wfmo_reactor_.owner_i ())
370 return this->current_info_[slot].delete_entry_ == true;
372 return this->current_info_[slot + 1].delete_entry_ == true;
376 ACE_WFMO_Reactor_Handler_Repository::invalid_handle (ACE_HANDLE handle) const
378 ACE_TRACE ("ACE_WFMO_Reactor_Handler_Repository::invalid_handle");
379 // It's too expensive to perform more exhaustive validity checks on
380 // Win32 due to the way that they implement SOCKET HANDLEs.
381 if (handle == ACE_INVALID_HANDLE)
391 ACE_WFMO_Reactor_Handler_Repository::changes_required ()
393 // Check if handles have be scheduled for additions or removal
394 return this->handles_to_be_added_ > 0
395 || this->handles_to_be_deleted_ > 0
396 || this->handles_to_be_suspended_ > 0
397 || this->handles_to_be_resumed_ > 0;
401 ACE_WFMO_Reactor_Handler_Repository::make_changes ()
403 // This method must ONLY be called by the
404 // <WFMO_Reactor->change_state_thread_>. We therefore assume that
405 // there will be no contention for this method and hence no guards
408 // Deletions and suspensions in current_info_
409 this->make_changes_in_current_infos ();
411 // Deletions and resumptions in current_suspended_info_
412 this->make_changes_in_suspension_infos ();
414 // Deletions in to_be_added_info_, or transfers to current_info_ or
415 // current_suspended_info_ from to_be_added_info_
416 this->make_changes_in_to_be_added_infos ();
422 ACE_WFMO_Reactor_Handler_Repository::unbind (ACE_HANDLE handle,
423 ACE_Reactor_Mask mask)
425 if (this->invalid_handle (handle))
428 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->wfmo_reactor_.lock_, -1);
430 bool changes_required = false;
431 int const result = this->unbind_i (handle,
435 if (changes_required)
436 // Wake up all threads in WaitForMultipleObjects so that they can
437 // reconsult the handle set
438 this->wfmo_reactor_.wakeup_all_threads ();
444 ACE_WFMO_Reactor::reset_timer_interval
446 const ACE_Time_Value &interval)
448 ACE_TRACE ("ACE_WFMO_Reactor::reset_timer_interval");
450 if (0 != this->timer_queue_)
452 long result = this->timer_queue_->reset_interval
456 // Wakeup the owner thread so that it gets the latest timer values
467 ACE_WFMO_Reactor::schedule_timer (ACE_Event_Handler *handler,
469 const ACE_Time_Value &delay_time,
470 const ACE_Time_Value &interval)
472 ACE_TRACE ("ACE_WFMO_Reactor::schedule_timer");
474 if (0 != this->timer_queue_)
476 long result = this->timer_queue_->schedule
479 timer_queue_->gettimeofday () + delay_time,
482 // Wakeup the owner thread so that it gets the latest timer values
493 ACE_WFMO_Reactor::cancel_timer (ACE_Event_Handler *handler,
494 int dont_call_handle_close)
496 ACE_TRACE ("ACE_WFMO_Reactor::cancel_timer");
497 if ((0 != this->timer_queue_) && (0 != handler))
498 return this->timer_queue_->cancel (handler, dont_call_handle_close);
503 ACE_WFMO_Reactor::cancel_timer (long timer_id,
505 int dont_call_handle_close)
507 ACE_TRACE ("ACE_WFMO_Reactor::cancel_timer");
508 if (0 != this->timer_queue_)
509 return this->timer_queue_->cancel (timer_id, arg, dont_call_handle_close);
514 ACE_WFMO_Reactor::register_handler (ACE_Event_Handler *event_handler,
515 ACE_HANDLE event_handle)
517 // This GUARD is necessary since we are updating shared state.
518 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
520 return this->handler_rep_.bind_i (0,
529 ACE_WFMO_Reactor::register_handler (ACE_Event_Handler *event_handler,
530 ACE_Reactor_Mask mask)
532 // This GUARD is necessary since we are updating shared state.
533 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
535 return this->register_handler_i (ACE_INVALID_HANDLE,
542 ACE_WFMO_Reactor::register_handler (ACE_HANDLE io_handle,
543 ACE_Event_Handler *event_handler,
544 ACE_Reactor_Mask mask)
546 // This GUARD is necessary since we are updating shared state.
547 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
549 return this->register_handler_i (ACE_INVALID_HANDLE,
556 ACE_WFMO_Reactor::register_handler (ACE_HANDLE event_handle,
557 ACE_HANDLE io_handle,
558 ACE_Event_Handler *event_handler,
559 ACE_Reactor_Mask mask)
561 // This GUARD is necessary since we are updating shared state.
562 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
564 return this->register_handler_i (event_handle,
571 ACE_WFMO_Reactor::register_handler (const ACE_Handle_Set &handles,
572 ACE_Event_Handler *handler,
573 ACE_Reactor_Mask mask)
575 // This GUARD is necessary since we are updating shared state.
576 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
578 ACE_Handle_Set_Iterator handle_iter (handles);
581 while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
582 if (this->register_handler_i (h,
592 ACE_WFMO_Reactor::schedule_wakeup (ACE_HANDLE io_handle,
593 ACE_Reactor_Mask masks_to_be_added)
595 // This GUARD is necessary since we are updating shared state.
596 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
598 return this->mask_ops_i (io_handle,
600 ACE_Reactor::ADD_MASK);
604 ACE_WFMO_Reactor::schedule_wakeup (ACE_Event_Handler *event_handler,
605 ACE_Reactor_Mask masks_to_be_added)
607 // This GUARD is necessary since we are updating shared state.
608 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
610 return this->mask_ops_i (event_handler->get_handle (),
612 ACE_Reactor::ADD_MASK);
616 ACE_WFMO_Reactor::cancel_wakeup (ACE_HANDLE io_handle,
617 ACE_Reactor_Mask masks_to_be_removed)
619 // This GUARD is necessary since we are updating shared state.
620 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
622 return this->mask_ops_i (io_handle,
624 ACE_Reactor::CLR_MASK);
628 ACE_WFMO_Reactor::cancel_wakeup (ACE_Event_Handler *event_handler,
629 ACE_Reactor_Mask masks_to_be_removed)
631 // This GUARD is necessary since we are updating shared state.
632 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
634 return this->mask_ops_i (event_handler->get_handle (),
636 ACE_Reactor::CLR_MASK);
640 ACE_WFMO_Reactor::remove_handler (ACE_Event_Handler *event_handler,
641 ACE_Reactor_Mask mask)
643 return this->handler_rep_.unbind (event_handler->get_handle (),
648 ACE_WFMO_Reactor::remove_handler (ACE_HANDLE handle,
649 ACE_Reactor_Mask mask)
651 return this->handler_rep_.unbind (handle,
656 ACE_WFMO_Reactor::remove_handler (const ACE_Handle_Set &handles,
657 ACE_Reactor_Mask mask)
659 ACE_Handle_Set_Iterator handle_iter (handles);
661 bool changes_required = false;
663 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
665 while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
666 if (this->handler_rep_.unbind_i (h,
668 changes_required) == -1)
671 // Wake up all threads in WaitForMultipleObjects so that they can
672 // reconsult the handle set
673 this->wakeup_all_threads ();
679 ACE_WFMO_Reactor::suspend_handler (ACE_HANDLE handle)
681 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
683 bool changes_required = false;
685 this->handler_rep_.suspend_handler_i (handle,
688 if (changes_required)
689 // Wake up all threads in WaitForMultipleObjects so that they can
690 // reconsult the handle set
691 this->wakeup_all_threads ();
697 ACE_WFMO_Reactor::suspend_handler (ACE_Event_Handler *event_handler)
699 return this->suspend_handler (event_handler->get_handle ());
703 ACE_WFMO_Reactor::suspend_handler (const ACE_Handle_Set &handles)
705 ACE_Handle_Set_Iterator handle_iter (handles);
707 bool changes_required = false;
709 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
711 while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
712 if (this->handler_rep_.suspend_handler_i (h,
713 changes_required) == -1)
716 // Wake up all threads in WaitForMultipleObjects so that they can
717 // reconsult the handle set
718 this->wakeup_all_threads ();
724 ACE_WFMO_Reactor::suspend_handlers ()
728 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
730 // First suspend all current handles
731 bool changes_required = false;
733 // Skip over the notify and wakeup_all_threads handles. These are registered
734 // by ACE_WFMO_Reactor::open(), not by users, and should not be suspended.
736 i < this->handler_rep_.max_handlep1_ && !error;
740 this->handler_rep_.suspend_handler_i (this->handler_rep_.current_handles_[i],
746 // Then suspend all to_be_added_handles
748 i < this->handler_rep_.handles_to_be_added_ && !error;
751 if (this->handler_rep_.to_be_added_info_[i].io_entry_)
754 this->handler_rep_.suspend_handler_i (this->handler_rep_.to_be_added_info_[i].io_handle_,
760 this->handler_rep_.suspend_handler_i (this->handler_rep_.to_be_added_info_[i].event_handle_,
767 // Wake up all threads in WaitForMultipleObjects so that they can
768 // reconsult the handle set
769 this->wakeup_all_threads ();
771 return error ? -1 : 0;
775 ACE_WFMO_Reactor::resume_handler (ACE_HANDLE handle)
777 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
779 bool changes_required = false;
781 this->handler_rep_.resume_handler_i (handle, changes_required);
783 if (changes_required)
784 // Wake up all threads in WaitForMultipleObjects so that they can
785 // reconsult the handle set
786 this->wakeup_all_threads ();
792 ACE_WFMO_Reactor::resume_handler (ACE_Event_Handler *event_handler)
794 return this->resume_handler (event_handler->get_handle ());
798 ACE_WFMO_Reactor::resume_handler (const ACE_Handle_Set &handles)
800 ACE_Handle_Set_Iterator handle_iter (handles);
802 bool changes_required = false;
804 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
806 while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
807 if (this->handler_rep_.resume_handler_i (h,
808 changes_required) == -1)
811 // Wake up all threads in WaitForMultipleObjects so that they can
812 // reconsult the handle set
813 this->wakeup_all_threads ();
819 ACE_WFMO_Reactor::resume_handlers ()
823 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
825 bool changes_required = false;
827 i < this->handler_rep_.suspended_handles_ && !error;
831 this->handler_rep_.resume_handler_i (this->handler_rep_.current_suspended_info_[i].event_handle_,
837 // Then resume all to_be_added_handles
839 i < this->handler_rep_.handles_to_be_added_ && !error;
842 if (this->handler_rep_.to_be_added_info_[i].io_entry_)
845 this->handler_rep_.resume_handler_i (this->handler_rep_.to_be_added_info_[i].io_handle_,
851 this->handler_rep_.resume_handler_i (this->handler_rep_.to_be_added_info_[i].event_handle_,
858 // Wake up all threads in WaitForMultipleObjects so that they can
859 // reconsult the handle set
860 this->wakeup_all_threads ();
862 return error ? -1 : 0;
866 ACE_WFMO_Reactor::uses_event_associations ()
868 // Since the WFMO_Reactor does use event associations, this function
874 ACE_WFMO_Reactor::handle_events (ACE_Time_Value &how_long)
876 return this->event_handling (&how_long, FALSE);
880 ACE_WFMO_Reactor::alertable_handle_events (ACE_Time_Value &how_long)
882 return this->event_handling (&how_long, TRUE);
886 ACE_WFMO_Reactor::handle_events (ACE_Time_Value *how_long)
888 return this->event_handling (how_long, FALSE);
892 ACE_WFMO_Reactor::alertable_handle_events (ACE_Time_Value *how_long)
894 return this->event_handling (how_long, TRUE);
898 ACE_WFMO_Reactor::deactivated ()
900 return this->deactivated_;
904 ACE_WFMO_Reactor::deactivate (int do_stop)
906 this->deactivated_ = do_stop;
907 this->wakeup_all_threads ();
911 ACE_WFMO_Reactor::owner (ACE_thread_t *t)
913 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
914 *t = this->owner_i ();
918 ACE_INLINE ACE_thread_t
919 ACE_WFMO_Reactor::owner_i ()
925 ACE_WFMO_Reactor::owner (ACE_thread_t new_owner, ACE_thread_t *old_owner)
927 ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1);
928 this->new_owner_ = new_owner;
931 *old_owner = this->owner_i ();
933 // Wake up all threads in WaitForMultipleObjects so that they can
934 // reconsult the new owner responsibilities
935 this->wakeup_all_threads ();
941 ACE_WFMO_Reactor::new_owner ()
943 return this->new_owner_ != ACE_thread_t (0);
947 ACE_WFMO_Reactor::change_owner ()
949 this->owner_ = this->new_owner_;
950 this->new_owner_ = ACE_thread_t (0);
955 ACE_WFMO_Reactor::safe_dispatch (DWORD wait_status)
960 result = this->dispatch (wait_status);
964 this->update_state ();
971 ACE_WFMO_Reactor::dispatch_window_messages ()
977 ACE_WFMO_Reactor::wakeup_all_threads ()
979 this->wakeup_all_threads_.signal ();
983 ACE_WFMO_Reactor::notify (ACE_Event_Handler *event_handler,
984 ACE_Reactor_Mask mask,
985 ACE_Time_Value *timeout)
987 return this->notify_handler_->notify (event_handler, mask, timeout);
991 ACE_WFMO_Reactor::register_handler (int signum,
992 ACE_Event_Handler *new_sh,
993 ACE_Sig_Action *new_disp,
994 ACE_Event_Handler **old_sh,
995 ACE_Sig_Action *old_disp)
997 return this->signal_handler_->register_handler (signum,
1003 ACE_WFMO_Reactor::register_handler (const ACE_Sig_Set &sigset,
1004 ACE_Event_Handler *new_sh,
1005 ACE_Sig_Action *new_disp)
1010 for (int s = 1; s < ACE_NSIG; s++)
1011 if (sigset.is_member (s)
1012 && this->signal_handler_->register_handler (s,
1017 ACE_UNUSED_ARG (sigset);
1018 ACE_UNUSED_ARG (new_sh);
1019 ACE_UNUSED_ARG (new_disp);
1020 #endif /* ACE_NSIG */
1026 ACE_WFMO_Reactor::remove_handler (int signum,
1027 ACE_Sig_Action *new_disp,
1028 ACE_Sig_Action *old_disp,
1031 return this->signal_handler_->remove_handler (signum,
1038 ACE_WFMO_Reactor::remove_handler (const ACE_Sig_Set &sigset)
1043 for (int s = 1; s < ACE_NSIG; s++)
1044 if (sigset.is_member (s)
1045 && this->signal_handler_->remove_handler (s) == -1)
1048 ACE_UNUSED_ARG (sigset);
1049 #endif /* ACE_NSIG */
1055 ACE_WFMO_Reactor::handler (int signum, ACE_Event_Handler **eh)
1057 ACE_Event_Handler *handler =
1058 this->signal_handler_->handler (signum);
1068 ACE_WFMO_Reactor::mask_ops (ACE_Event_Handler *event_handler,
1069 ACE_Reactor_Mask mask,
1072 ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1);
1074 return this->mask_ops_i (event_handler->get_handle (),
1080 ACE_WFMO_Reactor::mask_ops (ACE_HANDLE io_handle,
1081 ACE_Reactor_Mask mask,
1084 ACE_GUARD_RETURN (ACE_Process_Mutex, monitor, this->lock_, -1);
1086 return this->mask_ops_i (io_handle,
1092 ACE_WFMO_Reactor::requeue_position (int)
1098 ACE_WFMO_Reactor::requeue_position ()
1100 // Don't have an implementation for this yet...
1101 ACE_NOTSUP_RETURN (-1);
1105 ACE_WFMO_Reactor::restart ()
1111 ACE_WFMO_Reactor::restart (bool)
1117 ACE_WFMO_Reactor::ready_ops (ACE_Event_Handler *event_handler,
1118 ACE_Reactor_Mask mask,
1121 // Don't have an implementation for this yet...
1122 ACE_UNUSED_ARG (event_handler);
1123 ACE_UNUSED_ARG (mask);
1124 ACE_UNUSED_ARG (ops);
1125 ACE_NOTSUP_RETURN (-1);
1129 ACE_WFMO_Reactor::ready_ops (ACE_HANDLE handle,
1133 // Don't have an implementation for this yet...
1134 ACE_UNUSED_ARG (handle);
1135 ACE_UNUSED_ARG (ops);
1136 ACE_NOTSUP_RETURN (-1);
1139 ACE_INLINE ACE_Event_Handler *
1140 ACE_WFMO_Reactor::find_handler (ACE_HANDLE handle)
1142 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, 0);
1144 return this->handler_rep_.find_handler (handle);
1148 ACE_WFMO_Reactor::handler (ACE_HANDLE handle,
1149 ACE_Reactor_Mask mask,
1150 ACE_Event_Handler **event_handler)
1152 ACE_GUARD_RETURN (ACE_Process_Mutex, ace_mon, this->lock_, -1);
1154 return this->handler_rep_.handler (handle, mask, event_handler);
1158 ACE_WFMO_Reactor::initialized ()
1160 return this->open_for_business_;
1163 ACE_INLINE ACE_Lock &
1164 ACE_WFMO_Reactor::lock ()
1166 return this->lock_adapter_;
1170 ACE_WFMO_Reactor::size () const
1172 // Size of repository minus the 2 used for internal purposes
1173 return this->handler_rep_.max_size_ - 2;
1177 ACE_WFMO_Reactor_Handler_Repository::changes_required ()
1183 ACE_WFMO_Reactor_Handler_Repository::make_changes ()
1189 ACE_WFMO_Reactor_Handler_Repository::~ACE_WFMO_Reactor_Handler_Repository ()
1193 #endif /* ACE_WIN32 */
1195 ACE_END_VERSIONED_NAMESPACE_DECL