Also use Objects as part of an operation but as a result don't generate Any operation...
[ACE_TAO.git] / ACE / ace / Proactor.cpp
blob420379b359ef2cffb7aa4c5b970d2e3983c9f98a
1 #include /**/ "ace/config-lite.h"
2 #include "ace/Proactor.h"
3 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
5 // This only works on Win32 platforms and on Unix platforms with aio
6 // calls.
8 #include "ace/Auto_Ptr.h"
9 #include "ace/Proactor_Impl.h"
10 #include "ace/Object_Manager.h"
11 #include "ace/Task_T.h"
13 #if !defined (ACE_HAS_WINCE) && !defined (ACE_LACKS_ACE_SVCCONF)
14 # include "ace/Service_Config.h"
15 #endif /* !ACE_HAS_WINCE && !ACE_LACKS_ACE_SVCCONF */
18 #include "ace/Task_T.h"
19 #include "ace/Log_Category.h"
20 #include "ace/Framework_Component.h"
22 #if defined (ACE_HAS_AIO_CALLS)
23 # include "ace/POSIX_Proactor.h"
24 # include "ace/POSIX_CB_Proactor.h"
25 #else /* !ACE_HAS_AIO_CALLS */
26 # include "ace/WIN32_Proactor.h"
27 #endif /* ACE_HAS_AIO_CALLS */
29 #if !defined (__ACE_INLINE__)
30 #include "ace/Proactor.inl"
31 #endif /* __ACE_INLINE__ */
33 #include "ace/Auto_Event.h"
35 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
37 /// Process-wide ACE_Proactor.
38 ACE_Proactor *ACE_Proactor::proactor_ = 0;
40 /// Controls whether the Proactor is deleted when we shut down (we can
41 /// only delete it safely if we created it!)
42 bool ACE_Proactor::delete_proactor_ = false;
44 /**
45 * @class ACE_Proactor_Timer_Handler
47 * @brief A Handler for timer. It helps in the management of timers
48 * registered with the Proactor.
50 * This object has a thread that will wait on the earliest time
51 * in a list of timers and an event. When a timer expires, the
52 * thread will post a completion event on the port and go back
53 * to waiting on the timer queue and event. If the event is
54 * signaled, the thread will refresh the time it is currently
55 * waiting on (in case the earliest time has changed).
57 class ACE_Proactor_Timer_Handler : public ACE_Task<ACE_NULL_SYNCH>
59 public:
60 /// Constructor.
61 explicit ACE_Proactor_Timer_Handler (ACE_Proactor &proactor);
63 /// Destructor.
64 virtual ~ACE_Proactor_Timer_Handler (void);
66 /// Proactor calls this to shut down the timer handler
67 /// gracefully. Just calling the destructor alone doesnt do what
68 /// <destroy> does. <destroy> make sure the thread exits properly.
69 int destroy (void);
71 /// Proactor calls this to refresh the timer event thread, to wake
72 /// up the thread from a sleep. This is needed to make the thread
73 /// recompute its sleep time after changes to the timer queue.
74 int signal (void);
76 protected:
77 /// Run by a daemon thread to handle deferred processing. In other
78 /// words, this method will do the waiting on the earliest timer and
79 /// event.
80 virtual int svc (void);
82 /// Event to wait on.
83 ACE_Auto_Event timer_event_;
85 /// Proactor.
86 ACE_Proactor &proactor_;
88 /// Flag used to indicate when we are shutting down.
89 int shutting_down_;
92 ACE_Proactor_Timer_Handler::ACE_Proactor_Timer_Handler (ACE_Proactor &proactor)
93 : ACE_Task <ACE_NULL_SYNCH> (&proactor.thr_mgr_),
94 proactor_ (proactor),
95 shutting_down_ (0)
99 ACE_Proactor_Timer_Handler::~ACE_Proactor_Timer_Handler (void)
101 this->destroy();
105 ACE_Proactor_Timer_Handler::destroy (void)
107 // Mark for closing down.
108 this->shutting_down_ = 1;
110 // Signal timer event.
111 this->timer_event_.signal ();
113 // Wait for the Timer Handler thread to exit.
114 this->wait ();
115 return 0;
119 ACE_Proactor_Timer_Handler::signal (void)
121 return this->timer_event_.signal ();
125 ACE_Proactor_Timer_Handler::svc (void)
127 ACE_Time_Value absolute_time;
128 ACE_Time_Value relative_time;
129 int result = 0;
131 while (this->shutting_down_ == 0)
133 // Check whether the timer queue has any items in it.
134 if (this->proactor_.timer_queue ()->is_empty () == 0)
136 // Get the earliest absolute time.
137 absolute_time = this->proactor_.timer_queue ()->earliest_time ();
139 // Get current time from timer queue since we don't know
140 // which <gettimeofday> was used.
141 ACE_Time_Value cur_time =
142 this->proactor_.timer_queue ()->gettimeofday ();
144 // Compare absolute time with curent time received from the
145 // timer queue.
146 if (absolute_time > cur_time)
147 relative_time = absolute_time - cur_time;
148 else
149 relative_time = ACE_Time_Value::zero;
151 // Block for relative time.
152 result = this->timer_event_.wait (&relative_time, 0);
154 else
155 // The timer queue has no entries, so wait indefinitely.
156 result = this->timer_event_.wait ();
158 // Check for timer expiries.
159 if (result == -1)
161 switch (errno)
163 case ETIME:
164 // timeout: expire timers
165 this->proactor_.timer_queue ()->expire ();
166 break;
167 default:
168 // Error.
169 ACELIB_ERROR_RETURN ((LM_ERROR,
170 ACE_TEXT ("%N:%l:(%P | %t):%p\n"),
171 ACE_TEXT ("ACE_Proactor_Timer_Handler::svc:wait failed")),
172 -1);
176 return 0;
179 // *********************************************************************
181 ACE_Proactor_Handle_Timeout_Upcall::ACE_Proactor_Handle_Timeout_Upcall (void)
182 : proactor_ (0)
187 ACE_Proactor_Handle_Timeout_Upcall::registration (ACE_Proactor_Timer_Queue &,
188 ACE_Handler * handler,
189 const void *)
191 handler->proactor(proactor_);
192 return 0;
196 ACE_Proactor_Handle_Timeout_Upcall::preinvoke (ACE_Proactor_Timer_Queue &,
197 ACE_Handler *,
198 const void *,
199 int,
200 const ACE_Time_Value &,
201 const void *&)
203 return 0;
207 ACE_Proactor_Handle_Timeout_Upcall::postinvoke (ACE_Proactor_Timer_Queue &,
208 ACE_Handler *,
209 const void *,
210 int,
211 const ACE_Time_Value &,
212 const void *)
214 return 0;
218 ACE_Proactor_Handle_Timeout_Upcall::timeout (ACE_Proactor_Timer_Queue &,
219 ACE_Handler *handler,
220 const void *act,
221 int,
222 const ACE_Time_Value &time)
224 if (this->proactor_ == 0)
225 ACELIB_ERROR_RETURN ((LM_ERROR,
226 ACE_TEXT ("(%t) No Proactor set in ACE_Proactor_Handle_Timeout_Upcall,")
227 ACE_TEXT (" no completion port to post timeout to?!@\n")),
228 -1);
230 // Create the Asynch_Timer.
231 ACE_Asynch_Result_Impl *asynch_timer =
232 this->proactor_->create_asynch_timer (handler->proxy (),
233 act,
234 time,
235 ACE_INVALID_HANDLE,
237 -1);
239 if (asynch_timer == 0)
240 ACELIB_ERROR_RETURN ((LM_ERROR,
241 ACE_TEXT ("%N:%l:(%P | %t):%p\n"),
242 ACE_TEXT ("ACE_Proactor_Handle_Timeout_Upcall::timeout:")
243 ACE_TEXT ("create_asynch_timer failed")),
244 -1);
246 #if defined (ACE_HAS_CPP11)
247 std::unique_ptr<ACE_Asynch_Result_Impl> safe_asynch_timer (asynch_timer);
248 #else
249 auto_ptr<ACE_Asynch_Result_Impl> safe_asynch_timer (asynch_timer);
250 #endif /* ACE_HAS_CPP11 */
252 // Post a completion.
253 if (-1 == safe_asynch_timer->post_completion
254 (this->proactor_->implementation ()))
255 ACELIB_ERROR_RETURN ((LM_ERROR,
256 ACE_TEXT ("Failure in dealing with timers: ")
257 ACE_TEXT ("PostQueuedCompletionStatus failed\n")),
258 -1);
260 // The completion has been posted. The proactor is now responsible
261 // for managing the asynch_timer memory.
262 (void) safe_asynch_timer.release ();
264 return 0;
268 ACE_Proactor_Handle_Timeout_Upcall::cancel_type (ACE_Proactor_Timer_Queue &,
269 ACE_Handler *,
270 int,
271 int &)
273 // Do nothing
274 return 0;
278 ACE_Proactor_Handle_Timeout_Upcall::cancel_timer (ACE_Proactor_Timer_Queue &,
279 ACE_Handler *,
280 int,
281 int)
283 // Do nothing
284 return 0;
288 ACE_Proactor_Handle_Timeout_Upcall::deletion (ACE_Proactor_Timer_Queue &,
289 ACE_Handler *,
290 const void *)
292 // Do nothing
293 return 0;
297 ACE_Proactor_Handle_Timeout_Upcall::proactor (ACE_Proactor &proactor)
299 if (this->proactor_ == 0)
301 this->proactor_ = &proactor;
302 return 0;
304 else
305 ACELIB_ERROR_RETURN ((LM_ERROR,
306 ACE_TEXT ("ACE_Proactor_Handle_Timeout_Upcall is only suppose")
307 ACE_TEXT (" to be used with ONE (and only one) Proactor\n")),
308 -1);
311 // *********************************************************************
313 ACE_Proactor::ACE_Proactor (ACE_Proactor_Impl *implementation,
314 bool delete_implementation,
315 ACE_Proactor_Timer_Queue *tq)
316 : implementation_ (0),
317 delete_implementation_ (delete_implementation),
318 timer_handler_ (0),
319 timer_queue_ (0),
320 delete_timer_queue_ (0),
321 end_event_loop_ (0),
322 event_loop_thread_count_ (0)
324 this->implementation (implementation);
326 if (this->implementation () == 0)
328 #if defined (ACE_HAS_AIO_CALLS)
329 // POSIX Proactor.
330 # if defined (ACE_POSIX_AIOCB_PROACTOR)
331 ACE_NEW (implementation, ACE_POSIX_AIOCB_Proactor);
332 # elif defined (ACE_POSIX_SIG_PROACTOR)
333 ACE_NEW (implementation, ACE_POSIX_SIG_Proactor);
334 # else /* Default order: CB, SIG, AIOCB */
335 # if !defined(ACE_HAS_BROKEN_SIGEVENT_STRUCT)
336 ACE_NEW (implementation, ACE_POSIX_CB_Proactor);
337 # else
338 # if defined(ACE_HAS_POSIX_REALTIME_SIGNALS)
339 ACE_NEW (implementation, ACE_POSIX_SIG_Proactor);
340 # else
341 ACE_NEW (implementation, ACE_POSIX_AIOCB_Proactor);
342 # endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */
343 # endif /* !ACE_HAS_BROKEN_SIGEVENT_STRUCT */
344 # endif /* ACE_POSIX_AIOCB_PROACTOR */
345 #elif (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
346 // WIN_Proactor.
347 ACE_NEW (implementation,
348 ACE_WIN32_Proactor);
349 #endif /* ACE_HAS_AIO_CALLS */
350 this->implementation (implementation);
351 this->delete_implementation_ = true;
354 // Set the timer queue.
355 this->timer_queue (tq);
357 // Create the timer handler
358 ACE_NEW (this->timer_handler_,
359 ACE_Proactor_Timer_Handler (*this));
361 // Activate <timer_handler>.
362 if (this->timer_handler_->activate () == -1)
363 ACELIB_ERROR ((LM_ERROR,
364 ACE_TEXT ("%N:%l:(%P | %t):%p\n"),
365 ACE_TEXT ("Task::activate:could not create thread\n")));
368 ACE_Proactor::~ACE_Proactor (void)
370 this->close ();
373 ACE_Proactor *
374 ACE_Proactor::instance (size_t /* threads */)
376 ACE_TRACE ("ACE_Proactor::instance");
378 if (ACE_Proactor::proactor_ == 0)
380 // Perform Double-Checked Locking Optimization.
381 ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
382 *ACE_Static_Object_Lock::instance (),
383 0));
385 if (ACE_Proactor::proactor_ == 0)
387 ACE_NEW_RETURN (ACE_Proactor::proactor_,
388 ACE_Proactor,
391 ACE_Proactor::delete_proactor_ = true;
392 ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Proactor, ACE_Proactor::proactor_);
395 return ACE_Proactor::proactor_;
398 ACE_Proactor *
399 ACE_Proactor::instance (ACE_Proactor * r, bool delete_proactor)
401 ACE_TRACE ("ACE_Proactor::instance");
403 ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
404 *ACE_Static_Object_Lock::instance (), 0));
406 ACE_Proactor *t = ACE_Proactor::proactor_;
408 ACE_Proactor::delete_proactor_ = delete_proactor;
409 ACE_Proactor::proactor_ = r;
410 ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Proactor, ACE_Proactor::proactor_);
412 return t;
415 void
416 ACE_Proactor::close_singleton (void)
418 ACE_TRACE ("ACE_Proactor::close_singleton");
420 ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon,
421 *ACE_Static_Object_Lock::instance ()));
423 if (ACE_Proactor::delete_proactor_)
425 delete ACE_Proactor::proactor_;
426 ACE_Proactor::proactor_ = 0;
427 ACE_Proactor::delete_proactor_ = false;
431 const ACE_TCHAR *
432 ACE_Proactor::dll_name (void)
434 return ACE_TEXT ("ACE");
437 const ACE_TCHAR *
438 ACE_Proactor::name (void)
440 return ACE_TEXT ("ACE_Proactor");
444 ACE_Proactor::check_reconfiguration (ACE_Proactor *)
446 #if !defined (ACE_HAS_WINCE) && !defined (ACE_LACKS_ACE_SVCCONF)
447 if (ACE_Service_Config::reconfig_occurred ())
449 ACE_Service_Config::reconfigure ();
450 return 1;
452 #endif /* ! ACE_HAS_WINCE || ! ACE_LACKS_ACE_SVCCONF */
453 return 0;
457 ACE_Proactor::proactor_run_event_loop (PROACTOR_EVENT_HOOK eh)
459 ACE_TRACE ("ACE_Proactor::proactor_run_event_loop");
460 int result = 0;
463 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
465 // Early check. It is ok to do this without lock, since we care just
466 // whether it is zero or non-zero.
467 if (this->end_event_loop_ != 0)
468 return 0;
470 // First time you are in. Increment the thread count.
471 this->event_loop_thread_count_ ++;
474 // Run the event loop.
475 for (;;)
477 // Check the end loop flag. It is ok to do this without lock,
478 // since we care just whether it is zero or non-zero.
479 if (this->end_event_loop_ != 0)
480 break;
482 // <end_event_loop> is not set. Ready to do <handle_events>.
483 result = this->handle_events ();
485 if (eh != 0 && (*eh) (this))
486 continue;
488 if (result == -1)
489 break;
492 // Leaving the event loop. Decrement the thread count.
495 // Obtain the lock in the MT environments.
496 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
498 // Decrement the thread count.
499 this->event_loop_thread_count_ --;
501 if (this->event_loop_thread_count_ > 0
502 && this->end_event_loop_ != 0)
503 this->proactor_post_wakeup_completions (1);
506 return result;
509 // Handle events for -tv- time. handle_events updates -tv- to reflect
510 // time elapsed, so do not return until -tv- == 0, or an error occurs.
512 ACE_Proactor::proactor_run_event_loop (ACE_Time_Value &tv,
513 PROACTOR_EVENT_HOOK eh)
515 ACE_TRACE ("ACE_Proactor::proactor_run_event_loop");
516 int result = 0;
519 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
521 // Early check. It is ok to do this without lock, since we care just
522 // whether it is zero or non-zero.
523 if (this->end_event_loop_ != 0
524 || tv == ACE_Time_Value::zero)
525 return 0;
527 // First time you are in. Increment the thread count.
528 this->event_loop_thread_count_ ++;
531 // Run the event loop.
532 for (;;)
534 // Check the end loop flag. It is ok to do this without lock,
535 // since we care just whether it is zero or non-zero.
536 if (this->end_event_loop_ != 0)
537 break;
539 // <end_event_loop> is not set. Ready to do <handle_events>.
540 result = this->handle_events (tv);
542 if (eh != 0 && (*eh) (this))
543 continue;
545 if (result == -1 || result == 0)
546 break;
549 // Leaving the event loop. Decrement the thread count.
552 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
554 // Decrement the thread count.
555 this->event_loop_thread_count_ --;
557 if (this->event_loop_thread_count_ > 0
558 && this->end_event_loop_ != 0)
559 this->proactor_post_wakeup_completions (1);
562 return result;
566 ACE_Proactor::proactor_reset_event_loop(void)
568 ACE_TRACE ("ACE_Proactor::proactor_reset_event_loop");
570 // Obtain the lock in the MT environments.
571 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
573 this->end_event_loop_ = 0;
574 return 0;
578 ACE_Proactor::proactor_end_event_loop (void)
580 ACE_TRACE ("ACE_Proactor::proactor_end_event_loop");
582 int how_many = 0;
585 // Obtain the lock, set the end flag and post the wakeup
586 // completions.
587 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
589 // Set the end flag.
590 this->end_event_loop_ = 1;
592 // Number of completions to post.
593 how_many = this->event_loop_thread_count_;
594 if (how_many == 0)
595 return 0;
598 // Post completions to all the threads so that they will all wake
599 // up.
600 return this->proactor_post_wakeup_completions (how_many);
604 ACE_Proactor::proactor_event_loop_done (void)
606 ACE_TRACE ("ACE_Proactor::proactor_event_loop_done");
608 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
610 return this->end_event_loop_ != 0 ? 1 : 0 ;
614 ACE_Proactor::close (void)
616 // Close the implementation.
617 if (this->implementation ()->close () == -1)
618 ACELIB_ERROR ((LM_ERROR,
619 ACE_TEXT ("%N:%l:(%P | %t):%p\n"),
620 ACE_TEXT ("ACE_Proactor::close: implementation close")));
622 // Delete the implementation.
623 if (this->delete_implementation_)
625 delete this->implementation ();
626 this->implementation_ = 0;
629 // Delete the timer handler.
630 if (this->timer_handler_)
632 delete this->timer_handler_;
633 this->timer_handler_ = 0;
636 // Delete the timer queue.
637 if (this->delete_timer_queue_)
639 delete this->timer_queue_;
640 this->timer_queue_ = 0;
641 this->delete_timer_queue_ = 0;
643 else if (this->timer_queue_)
645 this->timer_queue_->close ();
646 this->timer_queue_ = 0;
649 return 0;
653 ACE_Proactor::register_handle (ACE_HANDLE handle,
654 const void *completion_key)
656 return this->implementation ()->register_handle (handle,
657 completion_key);
660 long
661 ACE_Proactor::schedule_timer (ACE_Handler &handler,
662 const void *act,
663 const ACE_Time_Value &time)
665 return this->schedule_timer (handler,
666 act,
667 time,
668 ACE_Time_Value::zero);
671 long
672 ACE_Proactor::schedule_repeating_timer (ACE_Handler &handler,
673 const void *act,
674 const ACE_Time_Value &interval)
676 return this->schedule_timer (handler,
677 act,
678 interval,
679 interval);
682 long
683 ACE_Proactor::schedule_timer (ACE_Handler &handler,
684 const void *act,
685 const ACE_Time_Value &time,
686 const ACE_Time_Value &interval)
688 // absolute time.
689 ACE_Time_Value absolute_time =
690 this->timer_queue_->gettimeofday () + time;
691 long result = this->timer_queue_->schedule (&handler,
692 act,
693 absolute_time,
694 interval);
695 if (result != -1)
697 // Signal the timer thread to make sure that new events are
698 // dispatched and the sleep time is updated.
699 (void) this->timer_handler_->signal ();
702 return result;
706 ACE_Proactor::cancel_timer (long timer_id,
707 const void **arg,
708 int dont_call_handle_close)
710 // No need to singal timer event here. Even if the cancel timer was
711 // the earliest, we will have an extra wakeup.
712 return this->timer_queue_->cancel (timer_id,
713 arg,
714 dont_call_handle_close);
718 ACE_Proactor::cancel_timer (ACE_Handler &handler,
719 int dont_call_handle_close)
721 // No need to signal timer event here. Even if the cancel timer was
722 // the earliest, we will have an extra wakeup.
723 return this->timer_queue_->cancel (&handler,
724 dont_call_handle_close);
728 ACE_Proactor::handle_events (ACE_Time_Value &wait_time)
730 return implementation ()->handle_events (wait_time);
734 ACE_Proactor::handle_events (void)
736 return this->implementation ()->handle_events ();
740 ACE_Proactor::wake_up_dispatch_threads (void)
742 return 0;
746 ACE_Proactor::close_dispatch_threads (int)
748 return 0;
751 size_t
752 ACE_Proactor::number_of_threads (void) const
754 return this->implementation ()->number_of_threads ();
757 void
758 ACE_Proactor::number_of_threads (size_t threads)
760 this->implementation ()->number_of_threads (threads);
763 ACE_Proactor_Timer_Queue *
764 ACE_Proactor::timer_queue (void) const
766 return this->timer_queue_;
769 void
770 ACE_Proactor::timer_queue (ACE_Proactor_Timer_Queue *tq)
772 // Cleanup old timer queue.
773 if (this->delete_timer_queue_)
775 delete this->timer_queue_;
776 this->delete_timer_queue_ = 0;
778 else if (this->timer_queue_)
780 this->timer_queue_->close ();
783 // New timer queue.
784 if (tq == 0)
786 ACE_NEW (this->timer_queue_,
787 TIMER_HEAP);
788 this->delete_timer_queue_ = 1;
790 else
792 this->timer_queue_ = tq;
793 this->delete_timer_queue_ = 0;
796 // Set the proactor in the timer queue's functor
797 typedef ACE_Timer_Queue_Upcall_Base<ACE_Handler*,ACE_Proactor_Handle_Timeout_Upcall> TQ_Base;
799 TQ_Base * tqb = dynamic_cast<TQ_Base*> (this->timer_queue_);
801 if (tqb != 0)
803 tqb->upcall_functor ().proactor (*this);
807 ACE_HANDLE
808 ACE_Proactor::get_handle (void) const
810 return this->implementation ()->get_handle ();
813 ACE_Proactor_Impl *
814 ACE_Proactor::implementation (void) const
816 return this->implementation_;
820 ACE_Asynch_Read_Stream_Impl *
821 ACE_Proactor::create_asynch_read_stream (void)
823 return this->implementation ()->create_asynch_read_stream ();
826 ACE_Asynch_Write_Stream_Impl *
827 ACE_Proactor::create_asynch_write_stream (void)
829 return this->implementation ()->create_asynch_write_stream ();
832 ACE_Asynch_Read_Dgram_Impl *
833 ACE_Proactor::create_asynch_read_dgram (void)
835 return this->implementation ()->create_asynch_read_dgram ();
838 ACE_Asynch_Write_Dgram_Impl *
839 ACE_Proactor::create_asynch_write_dgram (void)
841 return this->implementation ()->create_asynch_write_dgram ();
844 ACE_Asynch_Read_File_Impl *
845 ACE_Proactor::create_asynch_read_file (void)
847 return this->implementation ()->create_asynch_read_file ();
850 ACE_Asynch_Write_File_Impl *
851 ACE_Proactor::create_asynch_write_file (void)
853 return this->implementation ()->create_asynch_write_file ();
856 ACE_Asynch_Accept_Impl *
857 ACE_Proactor::create_asynch_accept (void)
859 return this->implementation ()->create_asynch_accept ();
862 ACE_Asynch_Connect_Impl *
863 ACE_Proactor::create_asynch_connect (void)
865 return this->implementation ()->create_asynch_connect ();
868 ACE_Asynch_Transmit_File_Impl *
869 ACE_Proactor::create_asynch_transmit_file (void)
871 return this->implementation ()->create_asynch_transmit_file ();
874 ACE_Asynch_Read_Stream_Result_Impl *
875 ACE_Proactor::create_asynch_read_stream_result
876 (ACE_Handler::Proxy_Ptr &handler_proxy,
877 ACE_HANDLE handle,
878 ACE_Message_Block &message_block,
879 u_long bytes_to_read,
880 const void* act,
881 ACE_HANDLE event,
882 int priority,
883 int signal_number)
885 return this->implementation ()->create_asynch_read_stream_result
886 (handler_proxy,
887 handle,
888 message_block,
889 bytes_to_read,
890 act,
891 event,
892 priority,
893 signal_number);
897 ACE_Asynch_Write_Stream_Result_Impl *
898 ACE_Proactor::create_asynch_write_stream_result
899 (ACE_Handler::Proxy_Ptr &handler_proxy,
900 ACE_HANDLE handle,
901 ACE_Message_Block &message_block,
902 u_long bytes_to_write,
903 const void* act,
904 ACE_HANDLE event,
905 int priority,
906 int signal_number)
908 return this->implementation ()->create_asynch_write_stream_result
909 (handler_proxy,
910 handle,
911 message_block,
912 bytes_to_write,
913 act,
914 event,
915 priority,
916 signal_number);
919 ACE_Asynch_Read_File_Result_Impl *
920 ACE_Proactor::create_asynch_read_file_result
921 (ACE_Handler::Proxy_Ptr &handler_proxy,
922 ACE_HANDLE handle,
923 ACE_Message_Block &message_block,
924 u_long bytes_to_read,
925 const void* act,
926 u_long offset,
927 u_long offset_high,
928 ACE_HANDLE event,
929 int priority,
930 int signal_number)
932 return this->implementation ()->create_asynch_read_file_result
933 (handler_proxy,
934 handle,
935 message_block,
936 bytes_to_read,
937 act,
938 offset,
939 offset_high,
940 event,
941 priority,
942 signal_number);
945 ACE_Asynch_Write_File_Result_Impl *
946 ACE_Proactor::create_asynch_write_file_result
947 (ACE_Handler::Proxy_Ptr &handler_proxy,
948 ACE_HANDLE handle,
949 ACE_Message_Block &message_block,
950 u_long bytes_to_write,
951 const void* act,
952 u_long offset,
953 u_long offset_high,
954 ACE_HANDLE event,
955 int priority,
956 int signal_number)
958 return this->implementation ()->create_asynch_write_file_result
959 (handler_proxy,
960 handle,
961 message_block,
962 bytes_to_write,
963 act,
964 offset,
965 offset_high,
966 event,
967 priority,
968 signal_number);
971 ACE_Asynch_Read_Dgram_Result_Impl *
972 ACE_Proactor::create_asynch_read_dgram_result
973 (ACE_Handler::Proxy_Ptr &handler_proxy,
974 ACE_HANDLE handle,
975 ACE_Message_Block *message_block,
976 size_t bytes_to_read,
977 int flags,
978 int protocol_family,
979 const void* act,
980 ACE_HANDLE event,
981 int priority,
982 int signal_number)
984 return this->implementation()->create_asynch_read_dgram_result
985 (handler_proxy,
986 handle,
987 message_block,
988 bytes_to_read,
989 flags,
990 protocol_family,
991 act,
992 event,
993 priority,
994 signal_number);
997 ACE_Asynch_Write_Dgram_Result_Impl *
998 ACE_Proactor::create_asynch_write_dgram_result
999 (ACE_Handler::Proxy_Ptr &handler_proxy,
1000 ACE_HANDLE handle,
1001 ACE_Message_Block *message_block,
1002 size_t bytes_to_write,
1003 int flags,
1004 const void* act,
1005 ACE_HANDLE event,
1006 int priority,
1007 int signal_number)
1009 return this->implementation()->create_asynch_write_dgram_result
1010 (handler_proxy,
1011 handle,
1012 message_block,
1013 bytes_to_write,
1014 flags,
1015 act,
1016 event,
1017 priority,
1018 signal_number);
1021 ACE_Asynch_Accept_Result_Impl *
1022 ACE_Proactor::create_asynch_accept_result
1023 (ACE_Handler::Proxy_Ptr &handler_proxy,
1024 ACE_HANDLE listen_handle,
1025 ACE_HANDLE accept_handle,
1026 ACE_Message_Block &message_block,
1027 u_long bytes_to_read,
1028 const void* act,
1029 ACE_HANDLE event,
1030 int priority,
1031 int signal_number)
1033 return this->implementation ()->create_asynch_accept_result
1034 (handler_proxy,
1035 listen_handle,
1036 accept_handle,
1037 message_block,
1038 bytes_to_read,
1039 act,
1040 event,
1041 priority,
1042 signal_number);
1045 ACE_Asynch_Connect_Result_Impl *
1046 ACE_Proactor::create_asynch_connect_result
1047 (ACE_Handler::Proxy_Ptr &handler_proxy,
1048 ACE_HANDLE connect_handle,
1049 const void* act,
1050 ACE_HANDLE event,
1051 int priority,
1052 int signal_number)
1054 return this->implementation ()->create_asynch_connect_result
1055 (handler_proxy,
1056 connect_handle,
1057 act,
1058 event,
1059 priority,
1060 signal_number);
1063 ACE_Asynch_Transmit_File_Result_Impl *
1064 ACE_Proactor::create_asynch_transmit_file_result
1065 (ACE_Handler::Proxy_Ptr &handler_proxy,
1066 ACE_HANDLE socket,
1067 ACE_HANDLE file,
1068 ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer,
1069 u_long bytes_to_write,
1070 u_long offset,
1071 u_long offset_high,
1072 u_long bytes_per_send,
1073 u_long flags,
1074 const void *act,
1075 ACE_HANDLE event,
1076 int priority,
1077 int signal_number)
1079 return this->implementation ()->create_asynch_transmit_file_result
1080 (handler_proxy,
1081 socket,
1082 file,
1083 header_and_trailer,
1084 bytes_to_write,
1085 offset,
1086 offset_high,
1087 bytes_per_send,
1088 flags,
1089 act,
1090 event,
1091 priority,
1092 signal_number);
1095 ACE_Asynch_Result_Impl *
1096 ACE_Proactor::create_asynch_timer
1097 (ACE_Handler::Proxy_Ptr &handler_proxy,
1098 const void *act,
1099 const ACE_Time_Value &tv,
1100 ACE_HANDLE event,
1101 int priority,
1102 int signal_number)
1104 return this->implementation ()->create_asynch_timer
1105 (handler_proxy,
1106 act,
1108 event,
1109 priority,
1110 signal_number);
1114 ACE_Proactor::proactor_post_wakeup_completions (int how_many)
1116 return this->implementation ()->post_wakeup_completions (how_many);
1119 void
1120 ACE_Proactor::implementation (ACE_Proactor_Impl *implementation)
1122 this->implementation_ = implementation;
1125 ACE_END_VERSIONED_NAMESPACE_DECL
1127 #else /* !ACE_WIN32 || !ACE_HAS_AIO_CALLS */
1129 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
1131 ACE_Proactor *
1132 ACE_Proactor::instance (size_t /* threads */)
1134 return 0;
1137 ACE_Proactor *
1138 ACE_Proactor::instance (ACE_Proactor *)
1140 return 0;
1143 void
1144 ACE_Proactor::close_singleton (void)
1149 ACE_Proactor::run_event_loop (void)
1151 // not implemented
1152 return -1;
1156 ACE_Proactor::run_event_loop (ACE_Time_Value &)
1158 // not implemented
1159 return -1;
1163 ACE_Proactor::end_event_loop (void)
1165 // not implemented
1166 return -1;
1169 sig_atomic_t
1170 ACE_Proactor::event_loop_done (void)
1172 return sig_atomic_t (1);
1175 ACE_END_VERSIONED_NAMESPACE_DECL
1177 #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */