Merge pull request #2309 from mitza-oci/warnings
[ACE_TAO.git] / ACE / ace / Select_Reactor_T.h
blobe515bc756b0beff0f51c192b6fea18c05f89c062
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file Select_Reactor_T.h
7 * @author Douglas C. Schmidt <d.schmidt@vanderbilt.edu>
8 */
9 //=============================================================================
11 #ifndef ACE_SELECT_REACTOR_T_H
12 #define ACE_SELECT_REACTOR_T_H
13 #include /**/ "ace/pre.h"
15 #include "ace/Select_Reactor_Base.h"
17 #if !defined (ACE_LACKS_PRAGMA_ONCE)
18 # pragma once
19 #endif /* ACE_LACKS_PRAGMA_ONCE */
21 #include "ace/Lock_Adapter_T.h"
22 #include "ace/Token.h"
24 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
26 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
27 typedef ACE_Token ACE_SELECT_TOKEN;
28 #else
29 typedef ACE_Noop_Token ACE_SELECT_TOKEN;
30 #endif /* ACE_MT_SAFE && ACE_MT_SAFE != 0 */
32 /**
33 * @class ACE_Select_Reactor_T
35 * @brief An object oriented event demultiplexor and event handler
36 * dispatcher.
38 * The ACE_Select_Reactor is an object-oriented event
39 * demultiplexor and event handler dispatcher. The sources of
40 * events that the ACE_Select_Reactor waits for and dispatches
41 * includes I/O events, signals, and timer events. All public
42 * methods acquire the main ACE_Reactor_Token lock and
43 * call down to private or protected methods, which assume that
44 * the lock is held and so therefore don't (re)acquire the lock.
46 template <class ACE_SELECT_REACTOR_TOKEN>
47 class ACE_Select_Reactor_T : public ACE_Select_Reactor_Impl
49 public:
50 /// If @a disable_notify_pipe is non-0 then the reactor will
51 /// not create a notification pipe, which will save two I/O handles
52 /// but will elide the notify() feature. If @a mask_signals is
53 /// true the reactor is "signal-safe" when dispatching handlers to
54 /// signal events, whereas if @a mask_signals is false the reactor will
55 /// be more efficient, but not signal-safe (which may be perfectly
56 /// fine if your application doesn't use the reactor to handle signals).
57 ACE_Select_Reactor_T (ACE_Sig_Handler * = 0,
58 ACE_Timer_Queue * = 0,
59 int disable_notify_pipe = ACE_DISABLE_NOTIFY_PIPE_DEFAULT,
60 ACE_Reactor_Notify *notify = 0,
61 bool mask_signals = true,
62 int s_queue = ACE_SELECT_TOKEN::FIFO);
64 /// Initialize @c ACE_Select_Reactor with size @arg size.
65 /// If @arg disable_notify_pipe is non-0 then the reactor will
66 /// not create a notification pipe, which will save two I/O handles
67 /// but will elide the notification feature. If @arg mask_signals is
68 /// true the reactor is "signal-safe" when dispatching handlers to
69 /// signal events, whereas if @arg mask_signals is false the reactor will
70 /// be more efficient, but not signal-safe (which may be perfectly
71 /// fine if your application doesn't use the reactor to handle signals).
72 /**
73 * @note On Unix platforms, the size parameter should be as large as
74 * the maximum number of file descriptors allowed for a given
75 * process. This is necessary since a file descriptor is used
76 * to directly index the array of event handlers maintained by
77 * the Reactor's handler repository. Direct indexing is used
78 * for efficiency reasons.
80 ACE_Select_Reactor_T (size_t size,
81 bool restart = false,
82 ACE_Sig_Handler * = 0,
83 ACE_Timer_Queue * = 0,
84 int disable_notify_pipe = ACE_DISABLE_NOTIFY_PIPE_DEFAULT,
85 ACE_Reactor_Notify *notify = 0,
86 bool mask_signals = true,
87 int s_queue = ACE_SELECT_TOKEN::FIFO);
89 /**
90 * Initialize the @c ACE_Select_Reactor to manage
91 * @arg max_number_of_handles. If @arg restart is non-0 then the
92 * @c ACE_Reactor's @c handle_events method will be restarted
93 * automatically when @c EINTR occurs. If @arg signal_handler or
94 * @arg timer_queue are non-0 they are used as the signal handler and
95 * timer queue, respectively. If @arg disable_notify_pipe is non-0 the
96 * notification pipe is not created, thereby saving two I/O handles.
98 * @note On Unix platforms, the @a maximum_number_of_handles parameter
99 * should be as large as the maximum number of file
100 * descriptors allowed for a given process. This is necessary
101 * since a file descriptor is used to directly index the array
102 * of event handlers maintained by the Reactor's handler
103 * repository. Direct indexing is used for efficiency
104 * reasons.
106 virtual int open (size_t max_number_of_handles = DEFAULT_SIZE,
107 bool restart = false,
108 ACE_Sig_Handler * = 0,
109 ACE_Timer_Queue * = 0,
110 int disable_notify_pipe = ACE_DISABLE_NOTIFY_PIPE_DEFAULT,
111 ACE_Reactor_Notify * = 0);
113 /// Returns -1 (not used in this implementation);
114 virtual int current_info (ACE_HANDLE, size_t &size);
116 /// Use a user specified signal handler instead.
117 virtual int set_sig_handler (ACE_Sig_Handler *signal_handler);
119 /// Set a user-specified timer queue.
120 virtual int timer_queue (ACE_Timer_Queue *tq);
122 /// Return the current ACE_Timer_Queue.
123 virtual ACE_Timer_Queue *timer_queue () const;
125 /// Close down the select_reactor and release all of its resources.
126 virtual int close ();
128 /// Close down the select_reactor and release all of its resources.
129 virtual ~ACE_Select_Reactor_T ();
131 // = Event loop drivers.
134 * Returns non-zero if there are I/O events "ready" for dispatching,
135 * but does not actually dispatch the event handlers. By default,
136 * don't block while checking this, i.e., "poll".
138 virtual int work_pending (const ACE_Time_Value &max_wait_time = ACE_Time_Value::zero);
140 //@{
142 * This event loop driver that blocks for @a max_wait_time before
143 * returning. It will return earlier if timer events, I/O events,
144 * or signal events occur. Note that @a max_wait_time can be 0, in
145 * which case this method blocks indefinitely until events occur.
147 * @a max_wait_time is decremented to reflect how much time this call
148 * took. For instance, if a time value of 3 seconds is passed to
149 * handle_events and an event occurs after 2 seconds,
150 * @a max_wait_time will equal 1 second. This can be used if an
151 * application wishes to handle events for some fixed amount of
152 * time.
154 * Returns the total number of I/O and Timer ACE_Event_Handler's
155 * that were dispatched, 0 if the @a max_wait_time elapsed without
156 * dispatching any handlers, or -1 if something goes wrong.
158 * Current alertable_handle_events() is identical to
159 * handle_events().
161 virtual int handle_events (ACE_Time_Value *max_wait_time = 0);
162 virtual int alertable_handle_events (ACE_Time_Value *max_wait_time = 0);
163 //@}
165 //@{
167 * This method is just like the one above, except the
168 * @a max_wait_time value is a reference and can therefore never be
169 * NULL.
171 * Current <alertable_handle_events> is identical to
172 * <handle_events>.
174 virtual int handle_events (ACE_Time_Value &max_wait_time);
175 virtual int alertable_handle_events (ACE_Time_Value &max_wait_time);
176 //@}
178 // = Event handling control.
181 * Return the status of Reactor. If this function returns 0, the reactor is
182 * actively handling events. If it returns non-zero, <handling_events> and
183 * <handle_alertable_events> return -1 immediately.
185 virtual int deactivated ();
188 * Control whether the Reactor will handle any more incoming events or not.
189 * If @a do_stop == 1, the Reactor will be disabled. By default, a reactor
190 * is in active state and can be deactivated/reactived as wish.
192 virtual void deactivate (int do_stop);
194 // = Register and remove ACE_Event_Handlers.
196 * Register a @a eh with a particular @a mask. Note that the
197 * <Select_Reactor> will call ACE_Event_Handler::get_handle() to
198 * extract the underlying I/O handle.
200 virtual int register_handler (ACE_Event_Handler *eh,
201 ACE_Reactor_Mask mask);
204 * Register a @a eh with a particular @a mask. Note that since the
205 * @a handle is given the Select_Reactor will *not* call
206 * ACE_Event_Handler::get_handle() to extract the underlying I/O
207 * handle.
209 virtual int register_handler (ACE_HANDLE handle,
210 ACE_Event_Handler *eh,
211 ACE_Reactor_Mask mask);
213 #if defined (ACE_WIN32)
214 // Originally this interface was available for all platforms, but
215 // because ACE_HANDLE is an int on non-Win32 platforms, compilers
216 // are not able to tell the difference between
217 // register_handler(ACE_Event_Handler*,ACE_Reactor_Mask) and
218 // register_handler(ACE_Event_Handler*,ACE_HANDLE). Therefore, we
219 // have restricted this method to Win32 only.
221 /// Not implemented.
222 virtual int register_handler (ACE_Event_Handler *event_handler,
223 ACE_HANDLE event_handle = ACE_INVALID_HANDLE);
224 #endif /* ACE_WIN32 */
226 /// Not implemented.
227 virtual int register_handler (ACE_HANDLE event_handle,
228 ACE_HANDLE io_handle,
229 ACE_Event_Handler *event_handler,
230 ACE_Reactor_Mask mask);
232 /// Register @a eh with all the @a handles in the <Handle_Set>.
233 virtual int register_handler (const ACE_Handle_Set &handles,
234 ACE_Event_Handler *eh,
235 ACE_Reactor_Mask mask);
238 * Register @a new_sh to handle the signal @a signum using the
239 * @a new_disp. Returns the @a old_sh that was previously registered
240 * (if any), along with the @a old_disp of the signal handler.
242 virtual int register_handler (int signum,
243 ACE_Event_Handler *new_sh,
244 ACE_Sig_Action *new_disp = 0,
245 ACE_Event_Handler **old_sh = 0,
246 ACE_Sig_Action *old_disp = 0);
248 /// Registers @a new_sh to handle a set of signals @a sigset using the
249 /// @a new_disp.
250 virtual int register_handler (const ACE_Sig_Set &sigset,
251 ACE_Event_Handler *new_sh,
252 ACE_Sig_Action *new_disp = 0);
255 * Removes the @a mask binding of @a eh from the Select_Reactor. If
256 * there are no more bindings for this @a eh then it is removed from
257 * the Select_Reactor. Note that the Select_Reactor will call
258 * <ACE_Event_Handler::get_handle> to extract the underlying I/O
259 * handle.
261 virtual int remove_handler (ACE_Event_Handler *eh,
262 ACE_Reactor_Mask mask);
265 * Removes the @a mask bind of Event_Handler whose handle is
266 * @a handle from the Select_Reactor. If there are no more bindings
267 * for this @a eh then it is removed from the Select_Reactor.
269 virtual int remove_handler (ACE_HANDLE handle,
270 ACE_Reactor_Mask);
273 * Removes all the @a mask bindings for handles in the @a handle_set
274 * bind of Event_Handler. If there are no more bindings for any
275 * of these handlers then they are removed from the Select_Reactor.
277 virtual int remove_handler (const ACE_Handle_Set &handle_set,
278 ACE_Reactor_Mask);
281 * Remove the ACE_Event_Handler currently associated with @a signum.
282 * @a sigkey is ignored in this implementation since there is only
283 * one instance of a signal handler. Install the new disposition
284 * (if given) and return the previous disposition (if desired by the
285 * caller). Returns 0 on success and -1 if @a signum is invalid.
287 virtual int remove_handler (int signum,
288 ACE_Sig_Action *new_disp,
289 ACE_Sig_Action *old_disp = 0,
290 int sigkey = -1);
292 /// Calls <remove_handler> for every signal in @a sigset.
293 virtual int remove_handler (const ACE_Sig_Set &sigset);
295 // = Suspend and resume Handlers.
297 /// Temporarily suspend the <Event_Handler> associated with @a eh.
298 virtual int suspend_handler (ACE_Event_Handler *eh);
300 /// Temporarily suspend the Event_Handler associated with @a handle.
301 virtual int suspend_handler (ACE_HANDLE handle);
303 /// Suspend all @a handles in handle set temporarily.
304 virtual int suspend_handler (const ACE_Handle_Set &handles);
306 /// Suspend all the <Event_Handlers> in the Select_Reactor.
307 virtual int suspend_handlers ();
309 /// Resume a temporarily suspend Event_Handler associated with
310 /// @a eh.
311 virtual int resume_handler (ACE_Event_Handler *eh);
313 /// Resume a temporarily suspended Event_Handler associated with
314 /// @a handle.
315 virtual int resume_handler (ACE_HANDLE handle);
317 /// Resume all @a handles in handle set.
318 virtual int resume_handler (const ACE_Handle_Set &handles);
320 /// Resume all the <Event_Handlers> in the Select_Reactor.
321 virtual int resume_handlers ();
324 * Return true if we any event associations were made by the reactor
325 * for the handles that it waits on, false otherwise. Since the
326 * Select_Reactor does not do any event associations, this function
327 * always return false.
329 virtual bool uses_event_associations ();
331 // = Timer management.
333 * Schedule an ACE_Event_Handler that will expire after an amount
334 * of time. The return value of this method, a timer_id value,
335 * uniquely identifies the event_handler in the ACE_Reactor's
336 * internal list of timers.
337 * This timer_id value can be used to cancel the timer
338 * with the cancel_timer() call.
340 * @see cancel_timer()
341 * @see reset_timer_interval()
343 * @param event_handler Event handler to schedule on reactor
344 * @param arg Argument passed to the handle_timeout() method of event_handler
345 * @param delay Time interval after which the timer will expire
346 * @param interval Time interval after which the timer will be automatically
347 * rescheduled
348 * @return -1 on failure, a timer_id value on success
350 virtual long schedule_timer (ACE_Event_Handler * event_handler,
351 const void *arg,
352 const ACE_Time_Value &delay,
353 const ACE_Time_Value &interval = ACE_Time_Value::zero);
356 * Resets the interval of the timer represented by @a timer_id to
357 * @a interval, which is specified in relative time to the current
358 * <gettimeofday>. If @a interval is equal to
359 * ACE_Time_Value::zero, the timer will become a non-rescheduling
360 * timer. Returns 0 if successful, -1 if not.
362 virtual int reset_timer_interval (long timer_id,
363 const ACE_Time_Value &interval);
366 * Cancel all <event_handlers> that match the address of
367 * @a event_handler. If @a dont_call_handle_close is 0 then the
368 * <handle_close> method of @a event_handler will be invoked.
369 * Returns number of handler's cancelled.
371 virtual int cancel_timer (ACE_Event_Handler *event_handler,
372 int dont_call_handle_close = 1);
375 * Cancel the single ACE_Event_Handler that matches the @a timer_id
376 * value (which was returned from the <schedule> method). If arg is
377 * non-NULL then it will be set to point to the ``magic cookie''
378 * argument passed in when the Event_Handler was registered. This
379 * makes it possible to free up the memory and avoid memory leaks.
380 * If @a dont_call_handle_close is 0 then the <handle_close> method
381 * of <event_handler> will be invoked. Returns 1 if cancellation
382 * succeeded and 0 if the @a timer_id wasn't found.
384 virtual int cancel_timer (long timer_id,
385 const void **arg = 0,
386 int dont_call_handle_close = 1);
388 // = High-level Event_Handler scheduling operations
390 /// ADD the dispatch MASK "bit" bound with the @a eh and the @a mask.
391 virtual int schedule_wakeup (ACE_Event_Handler *eh,
392 ACE_Reactor_Mask mask);
394 /// ADD the dispatch MASK "bit" bound with the @a handle and the @a mask.
395 virtual int schedule_wakeup (ACE_HANDLE handle,
396 ACE_Reactor_Mask mask);
398 /// CLR the dispatch MASK "bit" bound with the @a eh and the @a mask.
399 virtual int cancel_wakeup (ACE_Event_Handler *eh,
400 ACE_Reactor_Mask mask);
402 /// CLR the dispatch MASK "bit" bound with the @a handle and the @a mask.
403 virtual int cancel_wakeup (ACE_HANDLE handle,
404 ACE_Reactor_Mask mask);
406 // = Notification methods.
408 * Called by a thread when it wants to unblock the Select_Reactor.
409 * This wakeups the <ACE_Select_Reactor> if currently blocked in
410 * <select>/<poll>. Pass over both the Event_Handler *and* the
411 * @a mask to allow the caller to dictate which <Event_Handler>
412 * method the <Select_Reactor> will invoke. The ACE_Time_Value
413 * indicates how long to blocking trying to notify the
414 * <Select_Reactor>. If @a timeout == 0, the caller will block until
415 * action is possible, else will wait until the relative time
416 * specified in *@a timeout elapses).
418 virtual int notify (ACE_Event_Handler * = 0,
419 ACE_Reactor_Mask = ACE_Event_Handler::EXCEPT_MASK,
420 ACE_Time_Value * = 0);
423 * Set the maximum number of times that the
424 * ACE_Select_Reactor_Notify::handle_input() method will iterate and
425 * dispatch the ACE_Event_Handlers that are passed in via the
426 * notify pipe before breaking out of its recv loop. By default,
427 * this is set to -1, which means "iterate until the pipe is empty."
428 * Setting this to a value like "1 or 2" will increase "fairness"
429 * (and thus prevent starvation) at the expense of slightly higher
430 * dispatching overhead.
432 virtual void max_notify_iterations (int);
435 * Get the maximum number of times that the
436 * ACE_Select_Reactor_Notify::handle_input() method will iterate and
437 * dispatch the ACE_Event_Handlers that are passed in via the
438 * notify pipe before breaking out of its recv loop.
440 virtual int max_notify_iterations ();
442 /// Get the existing restart value.
443 virtual bool restart ();
445 /// Set a new value for restart and return the original value.
446 virtual bool restart (bool r);
448 /// Set position that the main ACE_Select_Reactor thread is requeued in the
449 /// list of waiters during a <notify> callback.
450 virtual void requeue_position (int);
452 /// Get position that the main ACE_Select_Reactor thread is requeued in the
453 /// list of waiters during a <notify> callback.
454 virtual int requeue_position ();
456 // = Low-level wait_set mask manipulation methods.
457 /// GET/SET/ADD/CLR the dispatch mask "bit" bound with the @a eh and
458 /// @a mask.
459 virtual int mask_ops (ACE_Event_Handler *eh,
460 ACE_Reactor_Mask mask,
461 int ops);
463 /// GET/SET/ADD/CLR the dispatch MASK "bit" bound with the @a handle
464 /// and @a mask.
465 virtual int mask_ops (ACE_HANDLE handle,
466 ACE_Reactor_Mask mask,
467 int ops);
469 // = Low-level ready_set mask manipulation methods.
470 /// GET/SET/ADD/CLR the ready "bit" bound with the @a eh and @a mask.
471 virtual int ready_ops (ACE_Event_Handler *eh,
472 ACE_Reactor_Mask mask,
473 int ops);
475 /// GET/SET/ADD/CLR the ready "bit" bound with the @a handle and @a mask.
476 virtual int ready_ops (ACE_HANDLE handle,
477 ACE_Reactor_Mask,
478 int ops);
480 /// Wake up all threads in waiting in the event loop
481 virtual void wakeup_all_threads ();
483 // = Only the owner thread can perform a <handle_events>.
485 /// Set the new owner of the thread and return the old owner.
486 virtual int owner (ACE_thread_t n_id, ACE_thread_t *o_id = 0);
488 /// Return the current owner of the thread.
489 virtual int owner (ACE_thread_t *);
491 // = Miscellaneous Handler operations.
494 * Return the Event_Handler associated with @a handle. Return 0 if
495 * @a handle is not registered.
497 virtual ACE_Event_Handler *find_handler (ACE_HANDLE handle);
500 * Check to see if @a handle is associated with a valid Event_Handler
501 * bound to @a mask. Return the @a eh associated with this @a handler
502 * if @a eh != 0.
504 virtual int handler (ACE_HANDLE handle,
505 ACE_Reactor_Mask mask,
506 ACE_Event_Handler **eh = 0);
509 * Check to see if @a signum is associated with a valid Event_Handler
510 * bound to a signal. Return the @a eh associated with this
511 * handler if @a eh != 0.
513 virtual int handler (int signum,
514 ACE_Event_Handler ** = 0);
516 /// Returns true if we've been successfully initialized, else false.
517 virtual bool initialized ();
519 /// Returns the current size of the Reactor's internal descriptor
520 /// table.
521 virtual size_t size () const;
524 * Returns a reference to the ACE_Reactor_Token that is
525 * used to serialize the internal processing logic.
526 * This can be useful for situations where you need to avoid
527 * deadlock efficiently when ACE_Event_Handlers are used in
528 * multiple threads.
530 virtual ACE_Lock &lock ();
532 /// Dump the state of an object.
533 virtual void dump () const;
535 /// Declare the dynamic allocation hooks.
536 ACE_ALLOC_HOOK_DECLARE;
538 protected:
539 // = Internal methods that do the actual work.
541 // All of these methods assume that the token
542 // lock is held by the public methods that call down to them.
544 /// Do the work of actually binding the @a handle and @a eh with the
545 /// @a mask.
546 virtual int register_handler_i (ACE_HANDLE handle,
547 ACE_Event_Handler *eh,
548 ACE_Reactor_Mask mask);
550 /// Register a set of @a handles.
551 virtual int register_handler_i (const ACE_Handle_Set &handles,
552 ACE_Event_Handler *handler,
553 ACE_Reactor_Mask mask);
555 /// Do the work of actually unbinding the @a handle and @a eh with the
556 /// @a mask.
557 virtual int remove_handler_i (ACE_HANDLE handle,
558 ACE_Reactor_Mask);
560 /// Remove a set of @a handles.
561 virtual int remove_handler_i (const ACE_Handle_Set &handles,
562 ACE_Reactor_Mask);
564 /// Suspend the <Event_Handler> associated with @a handle
565 virtual int suspend_i (ACE_HANDLE handle);
567 /// Check to see if the <Event_Handler> associated with @a handle is
568 /// suspended. Returns 0 if not, 1 if so.
569 virtual int is_suspended_i (ACE_HANDLE handle);
571 /// Resume the <Event_Handler> associated with @a handle
572 virtual int resume_i (ACE_HANDLE handle);
574 /// Implement the public handler method.
575 virtual ACE_Event_Handler *find_handler_i (ACE_HANDLE handle);
577 /// Implement the public handler method.
578 virtual int handler_i (ACE_HANDLE handle,
579 ACE_Reactor_Mask,
580 ACE_Event_Handler ** = 0);
582 /// Implement the public handler method.
583 virtual int handler_i (int signum, ACE_Event_Handler ** = 0);
586 * Check if there are any HANDLEs enabled in the <ready_set_>, and
587 * if so, update the @a handle_set and return the number ready. If
588 * there aren't any HANDLEs enabled return 0.
590 virtual int any_ready (ACE_Select_Reactor_Handle_Set &handle_set);
592 /// Implement the <any_ready> method, assuming that the Sig_Guard is
593 /// being held
594 virtual int any_ready_i (ACE_Select_Reactor_Handle_Set &handle_set);
596 /// Take corrective action when errors occur.
597 virtual int handle_error ();
599 /// Make sure the handles are all valid.
600 virtual int check_handles ();
602 /// Wait for events to occur.
603 virtual int wait_for_multiple_events (ACE_Select_Reactor_Handle_Set &,
604 ACE_Time_Value *);
606 // = Dispatching methods.
609 * Template Method that dispatches ACE_Event_Handlers for time
610 * events, I/O events, and signal events. Returns the total number
611 * of ACE_Event_Handlers that were dispatched or -1 if something
612 * goes wrong.
614 virtual int dispatch (int nfound,
615 ACE_Select_Reactor_Handle_Set &);
618 * Dispatch all timer handlers that have expired. Returns -1 if the
619 * state of the <wait_set_> has changed, else 0.
620 * <number_dispatched> is set to the number of timer handlers
621 * dispatched.
623 virtual int dispatch_timer_handlers (int &number_dispatched);
626 * Dispatch any notification handlers. Returns -1 if the state of
627 * the <wait_set_> has changed, else returns number of handlers
628 * notified.
630 virtual int dispatch_notification_handlers (ACE_Select_Reactor_Handle_Set &dispatch_set,
631 int &number_of_active_handles,
632 int &number_of_handlers_dispatched);
635 * Dispatch all the input/output/except handlers that are enabled in
636 * the @a dispatch_set. Updates @a number_of_active_handles and
637 * @a number_of_handlers_dispatched according to the behavior of the
638 * number Returns -1 if the state of the <wait_set_> has changed,
639 * else 0.
641 virtual int dispatch_io_handlers (ACE_Select_Reactor_Handle_Set &dispatch_set,
642 int &number_of_active_handles,
643 int &number_of_handlers_dispatched);
646 * Factors the dispatching of an io handle set (each WRITE, EXCEPT
647 * or READ set of handles). It updates the
648 * @a number_of_handlers_dispatched and invokes this->notify_handle
649 * for all the handles in <dispatch_set> using the @a mask,
650 * <ready_set> and @a callback parameters. Must return -1 if
651 * this->state_changed otherwise it must return 0.
653 virtual int dispatch_io_set (int number_of_active_handles,
654 int &number_of_handlers_dispatched,
655 int mask,
656 ACE_Handle_Set& dispatch_mask,
657 ACE_Handle_Set& ready_mask,
658 ACE_EH_PTMF callback);
660 /// Notify the appropriate @a callback in the context of the @a eh
661 /// associated with @a handle that a particular event has occurred.
662 virtual void notify_handle (ACE_HANDLE handle,
663 ACE_Reactor_Mask mask,
664 ACE_Handle_Set &,
665 ACE_Event_Handler *eh,
666 ACE_EH_PTMF callback);
668 /// Enqueue ourselves into the list of waiting threads at the
669 /// appropriate point specified by <requeue_position_>.
670 virtual void renew ();
672 /// Synchronization token for the MT_SAFE ACE_Select_Reactor.
673 ACE_SELECT_REACTOR_TOKEN token_;
675 /// Adapter used to return internal lock to outside world.
676 ACE_Lock_Adapter<ACE_SELECT_REACTOR_TOKEN> lock_adapter_;
678 /// Release the token lock when a Win32 structured exception occurs.
679 int release_token ();
681 /// Stops the VC++ compiler from bitching about exceptions and destructors
682 int handle_events_i (ACE_Time_Value *max_wait_time = 0);
684 /// This flag is used to keep track of whether we are actively handling
685 /// events or not.
686 sig_atomic_t deactivated_;
688 private:
689 ACE_Select_Reactor_T (const ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN> &) = delete;
690 ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN> &operator= (const ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN> &) = delete;
693 ACE_END_VERSIONED_NAMESPACE_DECL
695 #if defined (__ACE_INLINE__)
696 #include "ace/Select_Reactor_T.inl"
697 #endif /* __ACE_INLINE__ */
699 #include "ace/Select_Reactor_T.cpp"
701 #include /**/ "ace/post.h"
702 #endif /* ACE_SELECT_REACTOR_T_H */