Changes to attempt to silence bcc64x
[ACE_TAO.git] / ACE / ace / Proactor.cpp
blob061bcb930aaaaa459b08573e3bd77f551929f216
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.
7 #include "ace/Proactor_Impl.h"
8 #include "ace/Object_Manager.h"
9 #include "ace/Task_T.h"
11 #if !defined (ACE_LACKS_ACE_SVCCONF)
12 # include "ace/Service_Config.h"
13 #endif /* !ACE_LACKS_ACE_SVCCONF */
15 #include "ace/Task_T.h"
16 #include "ace/Log_Category.h"
17 #include "ace/Framework_Component.h"
19 #if defined (ACE_HAS_AIO_CALLS)
20 # include "ace/POSIX_Proactor.h"
21 # include "ace/POSIX_CB_Proactor.h"
22 #else /* !ACE_HAS_AIO_CALLS */
23 # include "ace/WIN32_Proactor.h"
24 #endif /* ACE_HAS_AIO_CALLS */
26 #if !defined (__ACE_INLINE__)
27 #include "ace/Proactor.inl"
28 #endif /* __ACE_INLINE__ */
30 #include "ace/Auto_Event.h"
32 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
34 /// Process-wide ACE_Proactor.
35 ACE_Proactor *ACE_Proactor::proactor_ = 0;
37 /// Controls whether the Proactor is deleted when we shut down (we can
38 /// only delete it safely if we created it!)
39 bool ACE_Proactor::delete_proactor_ = false;
41 /**
42 * @class ACE_Proactor_Timer_Handler
44 * @brief A Handler for timer. It helps in the management of timers
45 * registered with the Proactor.
47 * This object has a thread that will wait on the earliest time
48 * in a list of timers and an event. When a timer expires, the
49 * thread will post a completion event on the port and go back
50 * to waiting on the timer queue and event. If the event is
51 * signaled, the thread will refresh the time it is currently
52 * waiting on (in case the earliest time has changed).
54 class ACE_Proactor_Timer_Handler : public ACE_Task<ACE_NULL_SYNCH>
56 public:
57 /// Constructor.
58 explicit ACE_Proactor_Timer_Handler (ACE_Proactor &proactor);
60 /// Destructor.
61 ~ACE_Proactor_Timer_Handler () override;
63 /// Proactor calls this to shut down the timer handler
64 /// gracefully. Just calling the destructor alone doesnt do what
65 /// <destroy> does. <destroy> make sure the thread exits properly.
66 int destroy ();
68 /// Proactor calls this to refresh the timer event thread, to wake
69 /// up the thread from a sleep. This is needed to make the thread
70 /// recompute its sleep time after changes to the timer queue.
71 int signal ();
73 protected:
74 /// Run by a daemon thread to handle deferred processing. In other
75 /// words, this method will do the waiting on the earliest timer and
76 /// event.
77 int svc () override;
79 /// Event to wait on.
80 ACE_Auto_Event timer_event_;
82 /// Proactor.
83 ACE_Proactor &proactor_;
85 /// Flag used to indicate when we are shutting down.
86 int shutting_down_;
89 ACE_Proactor_Timer_Handler::ACE_Proactor_Timer_Handler (ACE_Proactor &proactor)
90 : ACE_Task <ACE_NULL_SYNCH> (&proactor.thr_mgr_),
91 proactor_ (proactor),
92 shutting_down_ (0)
96 ACE_Proactor_Timer_Handler::~ACE_Proactor_Timer_Handler ()
98 this->destroy();
102 ACE_Proactor_Timer_Handler::destroy ()
104 // Mark for closing down.
105 this->shutting_down_ = 1;
107 // Signal timer event.
108 this->timer_event_.signal ();
110 // Wait for the Timer Handler thread to exit.
111 this->wait ();
112 return 0;
116 ACE_Proactor_Timer_Handler::signal ()
118 return this->timer_event_.signal ();
122 ACE_Proactor_Timer_Handler::svc ()
124 ACE_Time_Value absolute_time;
125 ACE_Time_Value relative_time;
126 int result = 0;
128 while (this->shutting_down_ == 0)
130 // Check whether the timer queue has any items in it.
131 if (this->proactor_.timer_queue ()->is_empty () == 0)
133 // Get the earliest absolute time.
134 absolute_time = this->proactor_.timer_queue ()->earliest_time ();
136 // Get current time from timer queue since we don't know
137 // which <gettimeofday> was used.
138 ACE_Time_Value cur_time =
139 this->proactor_.timer_queue ()->gettimeofday ();
141 // Compare absolute time with curent time received from the
142 // timer queue.
143 if (absolute_time > cur_time)
144 relative_time = absolute_time - cur_time;
145 else
146 relative_time = ACE_Time_Value::zero;
148 // Block for relative time.
149 result = this->timer_event_.wait (&relative_time, 0);
151 else
152 // The timer queue has no entries, so wait indefinitely.
153 result = this->timer_event_.wait ();
155 // Check for timer expiries.
156 if (result == -1)
158 switch (errno)
160 case ETIME:
161 // timeout: expire timers
162 this->proactor_.timer_queue ()->expire ();
163 break;
164 default:
165 // Error.
166 ACELIB_ERROR_RETURN ((LM_ERROR,
167 ACE_TEXT ("%N:%l:(%P | %t):%p\n"),
168 ACE_TEXT ("ACE_Proactor_Timer_Handler::svc:wait failed")),
169 -1);
173 return 0;
176 // *********************************************************************
178 ACE_Proactor_Handle_Timeout_Upcall::ACE_Proactor_Handle_Timeout_Upcall ()
179 : proactor_ (0)
184 ACE_Proactor_Handle_Timeout_Upcall::registration (ACE_Proactor_Timer_Queue &,
185 ACE_Handler * handler,
186 const void *)
188 handler->proactor(proactor_);
189 return 0;
193 ACE_Proactor_Handle_Timeout_Upcall::preinvoke (ACE_Proactor_Timer_Queue &,
194 ACE_Handler *,
195 const void *,
196 int,
197 const ACE_Time_Value &,
198 const void *&)
200 return 0;
204 ACE_Proactor_Handle_Timeout_Upcall::postinvoke (ACE_Proactor_Timer_Queue &,
205 ACE_Handler *,
206 const void *,
207 int,
208 const ACE_Time_Value &,
209 const void *)
211 return 0;
215 ACE_Proactor_Handle_Timeout_Upcall::timeout (ACE_Proactor_Timer_Queue &,
216 ACE_Handler *handler,
217 const void *act,
218 int,
219 const ACE_Time_Value &time)
221 if (this->proactor_ == 0)
222 ACELIB_ERROR_RETURN ((LM_ERROR,
223 ACE_TEXT ("(%t) No Proactor set in ACE_Proactor_Handle_Timeout_Upcall,")
224 ACE_TEXT (" no completion port to post timeout to?!@\n")),
225 -1);
227 // Create the Asynch_Timer.
228 ACE_Asynch_Result_Impl *asynch_timer =
229 this->proactor_->create_asynch_timer (handler->proxy (),
230 act,
231 time,
232 ACE_INVALID_HANDLE,
234 -1);
236 if (asynch_timer == 0)
237 ACELIB_ERROR_RETURN ((LM_ERROR,
238 ACE_TEXT ("%N:%l:(%P | %t):%p\n"),
239 ACE_TEXT ("ACE_Proactor_Handle_Timeout_Upcall::timeout:")
240 ACE_TEXT ("create_asynch_timer failed")),
241 -1);
243 std::unique_ptr<ACE_Asynch_Result_Impl> safe_asynch_timer (asynch_timer);
245 // Post a completion.
246 if (-1 == safe_asynch_timer->post_completion
247 (this->proactor_->implementation ()))
248 ACELIB_ERROR_RETURN ((LM_ERROR,
249 ACE_TEXT ("Failure in dealing with timers: ")
250 ACE_TEXT ("PostQueuedCompletionStatus failed\n")),
251 -1);
253 // The completion has been posted. The proactor is now responsible
254 // for managing the asynch_timer memory.
255 (void) safe_asynch_timer.release ();
257 return 0;
261 ACE_Proactor_Handle_Timeout_Upcall::cancel_type (ACE_Proactor_Timer_Queue &,
262 ACE_Handler *,
263 int,
264 int &)
266 // Do nothing
267 return 0;
271 ACE_Proactor_Handle_Timeout_Upcall::cancel_timer (ACE_Proactor_Timer_Queue &,
272 ACE_Handler *,
273 int,
274 int)
276 // Do nothing
277 return 0;
281 ACE_Proactor_Handle_Timeout_Upcall::deletion (ACE_Proactor_Timer_Queue &,
282 ACE_Handler *,
283 const void *)
285 // Do nothing
286 return 0;
290 ACE_Proactor_Handle_Timeout_Upcall::proactor (ACE_Proactor &proactor)
292 if (this->proactor_ == 0)
294 this->proactor_ = &proactor;
295 return 0;
297 else
298 ACELIB_ERROR_RETURN ((LM_ERROR,
299 ACE_TEXT ("ACE_Proactor_Handle_Timeout_Upcall is only suppose")
300 ACE_TEXT (" to be used with ONE (and only one) Proactor\n")),
301 -1);
304 // *********************************************************************
306 ACE_Proactor::ACE_Proactor (ACE_Proactor_Impl *implementation,
307 bool delete_implementation,
308 ACE_Proactor_Timer_Queue *tq)
309 : implementation_ (0),
310 delete_implementation_ (delete_implementation),
311 timer_handler_ (0),
312 timer_queue_ (0),
313 delete_timer_queue_ (0),
314 end_event_loop_ (0),
315 event_loop_thread_count_ (0)
317 this->implementation (implementation);
319 if (this->implementation () == 0)
321 #if defined (ACE_HAS_AIO_CALLS)
322 // POSIX Proactor.
323 # if defined (ACE_POSIX_AIOCB_PROACTOR)
324 ACE_NEW (implementation, ACE_POSIX_AIOCB_Proactor);
325 # elif defined (ACE_POSIX_SIG_PROACTOR)
326 ACE_NEW (implementation, ACE_POSIX_SIG_Proactor);
327 # else /* Default order: CB, SIG, AIOCB */
328 # if !defined(ACE_HAS_BROKEN_SIGEVENT_STRUCT)
329 ACE_NEW (implementation, ACE_POSIX_CB_Proactor);
330 # else
331 # if defined(ACE_HAS_POSIX_REALTIME_SIGNALS)
332 ACE_NEW (implementation, ACE_POSIX_SIG_Proactor);
333 # else
334 ACE_NEW (implementation, ACE_POSIX_AIOCB_Proactor);
335 # endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */
336 # endif /* !ACE_HAS_BROKEN_SIGEVENT_STRUCT */
337 # endif /* ACE_POSIX_AIOCB_PROACTOR */
338 #elif defined (ACE_WIN32)
339 // WIN_Proactor.
340 ACE_NEW (implementation,
341 ACE_WIN32_Proactor);
342 #endif /* ACE_HAS_AIO_CALLS */
343 this->implementation (implementation);
344 this->delete_implementation_ = true;
347 // Set the timer queue.
348 this->timer_queue (tq);
350 // Create the timer handler
351 ACE_NEW (this->timer_handler_,
352 ACE_Proactor_Timer_Handler (*this));
354 // Activate <timer_handler>.
355 if (this->timer_handler_->activate () == -1)
356 ACELIB_ERROR ((LM_ERROR,
357 ACE_TEXT ("%N:%l:(%P | %t):%p\n"),
358 ACE_TEXT ("Task::activate:could not create thread\n")));
361 ACE_Proactor::~ACE_Proactor ()
363 this->close ();
366 ACE_Proactor *
367 ACE_Proactor::instance (size_t /* threads */)
369 ACE_TRACE ("ACE_Proactor::instance");
371 if (ACE_Proactor::proactor_ == 0)
373 // Perform Double-Checked Locking Optimization.
374 ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
375 *ACE_Static_Object_Lock::instance (),
376 0));
378 if (ACE_Proactor::proactor_ == 0)
380 ACE_NEW_RETURN (ACE_Proactor::proactor_,
381 ACE_Proactor,
384 ACE_Proactor::delete_proactor_ = true;
385 ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Proactor, ACE_Proactor::proactor_);
388 return ACE_Proactor::proactor_;
391 ACE_Proactor *
392 ACE_Proactor::instance (ACE_Proactor * r, bool delete_proactor)
394 ACE_TRACE ("ACE_Proactor::instance");
396 ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
397 *ACE_Static_Object_Lock::instance (), 0));
399 ACE_Proactor *t = ACE_Proactor::proactor_;
401 ACE_Proactor::delete_proactor_ = delete_proactor;
402 ACE_Proactor::proactor_ = r;
403 ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Proactor, ACE_Proactor::proactor_);
405 return t;
408 void
409 ACE_Proactor::close_singleton ()
411 ACE_TRACE ("ACE_Proactor::close_singleton");
413 ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon,
414 *ACE_Static_Object_Lock::instance ()));
416 if (ACE_Proactor::delete_proactor_)
418 delete ACE_Proactor::proactor_;
419 ACE_Proactor::proactor_ = 0;
420 ACE_Proactor::delete_proactor_ = false;
424 const ACE_TCHAR *
425 ACE_Proactor::dll_name ()
427 return ACE_TEXT ("ACE");
430 const ACE_TCHAR *
431 ACE_Proactor::name ()
433 return ACE_TEXT ("ACE_Proactor");
437 ACE_Proactor::check_reconfiguration (ACE_Proactor *)
439 #if !defined (ACE_LACKS_ACE_SVCCONF)
440 if (ACE_Service_Config::reconfig_occurred ())
442 ACE_Service_Config::reconfigure ();
443 return 1;
445 #endif /* !ACE_LACKS_ACE_SVCCONF */
446 return 0;
450 ACE_Proactor::proactor_run_event_loop (PROACTOR_EVENT_HOOK eh)
452 ACE_TRACE ("ACE_Proactor::proactor_run_event_loop");
453 int result = 0;
456 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
458 // Early check. It is ok to do this without lock, since we care just
459 // whether it is zero or non-zero.
460 if (this->end_event_loop_ != 0)
461 return 0;
463 // First time you are in. Increment the thread count.
464 this->event_loop_thread_count_ ++;
467 // Run the event loop.
468 for (;;)
470 // Check the end loop flag. It is ok to do this without lock,
471 // since we care just whether it is zero or non-zero.
472 if (this->end_event_loop_ != 0)
473 break;
475 // <end_event_loop> is not set. Ready to do <handle_events>.
476 result = this->handle_events ();
478 if (eh != 0 && (*eh) (this))
479 continue;
481 if (result == -1)
482 break;
485 // Leaving the event loop. Decrement the thread count.
488 // Obtain the lock in the MT environments.
489 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
491 // Decrement the thread count.
492 this->event_loop_thread_count_ --;
494 if (this->event_loop_thread_count_ > 0
495 && this->end_event_loop_ != 0)
496 this->proactor_post_wakeup_completions (1);
499 return result;
502 // Handle events for -tv- time. handle_events updates -tv- to reflect
503 // time elapsed, so do not return until -tv- == 0, or an error occurs.
505 ACE_Proactor::proactor_run_event_loop (ACE_Time_Value &tv,
506 PROACTOR_EVENT_HOOK eh)
508 ACE_TRACE ("ACE_Proactor::proactor_run_event_loop");
509 int result = 0;
512 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
514 // Early check. It is ok to do this without lock, since we care just
515 // whether it is zero or non-zero.
516 if (this->end_event_loop_ != 0
517 || tv == ACE_Time_Value::zero)
518 return 0;
520 // First time you are in. Increment the thread count.
521 this->event_loop_thread_count_ ++;
524 // Run the event loop.
525 for (;;)
527 // Check the end loop flag. It is ok to do this without lock,
528 // since we care just whether it is zero or non-zero.
529 if (this->end_event_loop_ != 0)
530 break;
532 // <end_event_loop> is not set. Ready to do <handle_events>.
533 result = this->handle_events (tv);
535 if (eh != 0 && (*eh) (this))
536 continue;
538 if (result == -1 || result == 0)
539 break;
542 // Leaving the event loop. Decrement the thread count.
545 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
547 // Decrement the thread count.
548 this->event_loop_thread_count_ --;
550 if (this->event_loop_thread_count_ > 0
551 && this->end_event_loop_ != 0)
552 this->proactor_post_wakeup_completions (1);
555 return result;
559 ACE_Proactor::proactor_reset_event_loop()
561 ACE_TRACE ("ACE_Proactor::proactor_reset_event_loop");
563 // Obtain the lock in the MT environments.
564 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
566 this->end_event_loop_ = 0;
567 return 0;
571 ACE_Proactor::proactor_end_event_loop ()
573 ACE_TRACE ("ACE_Proactor::proactor_end_event_loop");
575 int how_many = 0;
578 // Obtain the lock, set the end flag and post the wakeup
579 // completions.
580 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
582 // Set the end flag.
583 this->end_event_loop_ = 1;
585 // Number of completions to post.
586 how_many = this->event_loop_thread_count_;
587 if (how_many == 0)
588 return 0;
591 // Post completions to all the threads so that they will all wake
592 // up.
593 return this->proactor_post_wakeup_completions (how_many);
597 ACE_Proactor::proactor_event_loop_done ()
599 ACE_TRACE ("ACE_Proactor::proactor_event_loop_done");
601 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
603 return this->end_event_loop_ != 0 ? 1 : 0 ;
607 ACE_Proactor::close ()
609 // Close the implementation.
610 if (this->implementation ()->close () == -1)
611 ACELIB_ERROR ((LM_ERROR,
612 ACE_TEXT ("%N:%l:(%P | %t):%p\n"),
613 ACE_TEXT ("ACE_Proactor::close: implementation close")));
615 // Delete the implementation.
616 if (this->delete_implementation_)
618 delete this->implementation ();
619 this->implementation_ = 0;
622 // Delete the timer handler.
623 if (this->timer_handler_)
625 delete this->timer_handler_;
626 this->timer_handler_ = 0;
629 // Delete the timer queue.
630 if (this->delete_timer_queue_)
632 delete this->timer_queue_;
633 this->timer_queue_ = 0;
634 this->delete_timer_queue_ = 0;
636 else if (this->timer_queue_)
638 this->timer_queue_->close ();
639 this->timer_queue_ = 0;
642 return 0;
646 ACE_Proactor::register_handle (ACE_HANDLE handle,
647 const void *completion_key)
649 return this->implementation ()->register_handle (handle,
650 completion_key);
653 long
654 ACE_Proactor::schedule_timer (ACE_Handler &handler,
655 const void *act,
656 const ACE_Time_Value &time)
658 return this->schedule_timer (handler,
659 act,
660 time,
661 ACE_Time_Value::zero);
664 long
665 ACE_Proactor::schedule_repeating_timer (ACE_Handler &handler,
666 const void *act,
667 const ACE_Time_Value &interval)
669 return this->schedule_timer (handler,
670 act,
671 interval,
672 interval);
675 long
676 ACE_Proactor::schedule_timer (ACE_Handler &handler,
677 const void *act,
678 const ACE_Time_Value &time,
679 const ACE_Time_Value &interval)
681 // absolute time.
682 ACE_Time_Value absolute_time =
683 this->timer_queue_->gettimeofday () + time;
684 long result = this->timer_queue_->schedule (&handler,
685 act,
686 absolute_time,
687 interval);
688 if (result != -1)
690 // Signal the timer thread to make sure that new events are
691 // dispatched and the sleep time is updated.
692 (void) this->timer_handler_->signal ();
695 return result;
699 ACE_Proactor::cancel_timer (long timer_id,
700 const void **arg,
701 int dont_call_handle_close)
703 // No need to singal timer event here. Even if the cancel timer was
704 // the earliest, we will have an extra wakeup.
705 return this->timer_queue_->cancel (timer_id,
706 arg,
707 dont_call_handle_close);
711 ACE_Proactor::cancel_timer (ACE_Handler &handler,
712 int dont_call_handle_close)
714 // No need to signal timer event here. Even if the cancel timer was
715 // the earliest, we will have an extra wakeup.
716 return this->timer_queue_->cancel (&handler,
717 dont_call_handle_close);
721 ACE_Proactor::handle_events (ACE_Time_Value &wait_time)
723 return implementation ()->handle_events (wait_time);
727 ACE_Proactor::handle_events ()
729 return this->implementation ()->handle_events ();
733 ACE_Proactor::wake_up_dispatch_threads ()
735 return 0;
739 ACE_Proactor::close_dispatch_threads (int)
741 return 0;
744 size_t
745 ACE_Proactor::number_of_threads () const
747 return this->implementation ()->number_of_threads ();
750 void
751 ACE_Proactor::number_of_threads (size_t threads)
753 this->implementation ()->number_of_threads (threads);
756 ACE_Proactor_Timer_Queue *
757 ACE_Proactor::timer_queue () const
759 return this->timer_queue_;
762 void
763 ACE_Proactor::timer_queue (ACE_Proactor_Timer_Queue *tq)
765 // Cleanup old timer queue.
766 if (this->delete_timer_queue_)
768 delete this->timer_queue_;
769 this->delete_timer_queue_ = 0;
771 else if (this->timer_queue_)
773 this->timer_queue_->close ();
776 // New timer queue.
777 if (tq == 0)
779 ACE_NEW (this->timer_queue_,
780 TIMER_HEAP);
781 this->delete_timer_queue_ = 1;
783 else
785 this->timer_queue_ = tq;
786 this->delete_timer_queue_ = 0;
789 // Set the proactor in the timer queue's functor
790 using TQ_Base = ACE_Timer_Queue_Upcall_Base<ACE_Handler *, ACE_Proactor_Handle_Timeout_Upcall>;
792 TQ_Base * tqb = dynamic_cast<TQ_Base*> (this->timer_queue_);
794 if (tqb != 0)
796 tqb->upcall_functor ().proactor (*this);
800 ACE_HANDLE
801 ACE_Proactor::get_handle () const
803 return this->implementation ()->get_handle ();
806 ACE_Proactor_Impl *
807 ACE_Proactor::implementation () const
809 return this->implementation_;
813 ACE_Asynch_Read_Stream_Impl *
814 ACE_Proactor::create_asynch_read_stream ()
816 return this->implementation ()->create_asynch_read_stream ();
819 ACE_Asynch_Write_Stream_Impl *
820 ACE_Proactor::create_asynch_write_stream ()
822 return this->implementation ()->create_asynch_write_stream ();
825 ACE_Asynch_Read_Dgram_Impl *
826 ACE_Proactor::create_asynch_read_dgram ()
828 return this->implementation ()->create_asynch_read_dgram ();
831 ACE_Asynch_Write_Dgram_Impl *
832 ACE_Proactor::create_asynch_write_dgram ()
834 return this->implementation ()->create_asynch_write_dgram ();
837 ACE_Asynch_Read_File_Impl *
838 ACE_Proactor::create_asynch_read_file ()
840 return this->implementation ()->create_asynch_read_file ();
843 ACE_Asynch_Write_File_Impl *
844 ACE_Proactor::create_asynch_write_file ()
846 return this->implementation ()->create_asynch_write_file ();
849 ACE_Asynch_Accept_Impl *
850 ACE_Proactor::create_asynch_accept ()
852 return this->implementation ()->create_asynch_accept ();
855 ACE_Asynch_Connect_Impl *
856 ACE_Proactor::create_asynch_connect ()
858 return this->implementation ()->create_asynch_connect ();
861 ACE_Asynch_Transmit_File_Impl *
862 ACE_Proactor::create_asynch_transmit_file ()
864 return this->implementation ()->create_asynch_transmit_file ();
867 ACE_Asynch_Read_Stream_Result_Impl *
868 ACE_Proactor::create_asynch_read_stream_result
869 (ACE_Handler::Proxy_Ptr &handler_proxy,
870 ACE_HANDLE handle,
871 ACE_Message_Block &message_block,
872 u_long bytes_to_read,
873 const void* act,
874 ACE_HANDLE event,
875 int priority,
876 int signal_number)
878 return this->implementation ()->create_asynch_read_stream_result
879 (handler_proxy,
880 handle,
881 message_block,
882 bytes_to_read,
883 act,
884 event,
885 priority,
886 signal_number);
890 ACE_Asynch_Write_Stream_Result_Impl *
891 ACE_Proactor::create_asynch_write_stream_result
892 (ACE_Handler::Proxy_Ptr &handler_proxy,
893 ACE_HANDLE handle,
894 ACE_Message_Block &message_block,
895 u_long bytes_to_write,
896 const void* act,
897 ACE_HANDLE event,
898 int priority,
899 int signal_number)
901 return this->implementation ()->create_asynch_write_stream_result
902 (handler_proxy,
903 handle,
904 message_block,
905 bytes_to_write,
906 act,
907 event,
908 priority,
909 signal_number);
912 ACE_Asynch_Read_File_Result_Impl *
913 ACE_Proactor::create_asynch_read_file_result
914 (ACE_Handler::Proxy_Ptr &handler_proxy,
915 ACE_HANDLE handle,
916 ACE_Message_Block &message_block,
917 u_long bytes_to_read,
918 const void* act,
919 u_long offset,
920 u_long offset_high,
921 ACE_HANDLE event,
922 int priority,
923 int signal_number)
925 return this->implementation ()->create_asynch_read_file_result
926 (handler_proxy,
927 handle,
928 message_block,
929 bytes_to_read,
930 act,
931 offset,
932 offset_high,
933 event,
934 priority,
935 signal_number);
938 ACE_Asynch_Write_File_Result_Impl *
939 ACE_Proactor::create_asynch_write_file_result
940 (ACE_Handler::Proxy_Ptr &handler_proxy,
941 ACE_HANDLE handle,
942 ACE_Message_Block &message_block,
943 u_long bytes_to_write,
944 const void* act,
945 u_long offset,
946 u_long offset_high,
947 ACE_HANDLE event,
948 int priority,
949 int signal_number)
951 return this->implementation ()->create_asynch_write_file_result
952 (handler_proxy,
953 handle,
954 message_block,
955 bytes_to_write,
956 act,
957 offset,
958 offset_high,
959 event,
960 priority,
961 signal_number);
964 ACE_Asynch_Read_Dgram_Result_Impl *
965 ACE_Proactor::create_asynch_read_dgram_result
966 (ACE_Handler::Proxy_Ptr &handler_proxy,
967 ACE_HANDLE handle,
968 ACE_Message_Block *message_block,
969 size_t bytes_to_read,
970 int flags,
971 int protocol_family,
972 const void* act,
973 ACE_HANDLE event,
974 int priority,
975 int signal_number)
977 return this->implementation()->create_asynch_read_dgram_result
978 (handler_proxy,
979 handle,
980 message_block,
981 bytes_to_read,
982 flags,
983 protocol_family,
984 act,
985 event,
986 priority,
987 signal_number);
990 ACE_Asynch_Write_Dgram_Result_Impl *
991 ACE_Proactor::create_asynch_write_dgram_result
992 (ACE_Handler::Proxy_Ptr &handler_proxy,
993 ACE_HANDLE handle,
994 ACE_Message_Block *message_block,
995 size_t bytes_to_write,
996 int flags,
997 const void* act,
998 ACE_HANDLE event,
999 int priority,
1000 int signal_number)
1002 return this->implementation()->create_asynch_write_dgram_result
1003 (handler_proxy,
1004 handle,
1005 message_block,
1006 bytes_to_write,
1007 flags,
1008 act,
1009 event,
1010 priority,
1011 signal_number);
1014 ACE_Asynch_Accept_Result_Impl *
1015 ACE_Proactor::create_asynch_accept_result
1016 (ACE_Handler::Proxy_Ptr &handler_proxy,
1017 ACE_HANDLE listen_handle,
1018 ACE_HANDLE accept_handle,
1019 ACE_Message_Block &message_block,
1020 u_long bytes_to_read,
1021 const void* act,
1022 ACE_HANDLE event,
1023 int priority,
1024 int signal_number)
1026 return this->implementation ()->create_asynch_accept_result
1027 (handler_proxy,
1028 listen_handle,
1029 accept_handle,
1030 message_block,
1031 bytes_to_read,
1032 act,
1033 event,
1034 priority,
1035 signal_number);
1038 ACE_Asynch_Connect_Result_Impl *
1039 ACE_Proactor::create_asynch_connect_result
1040 (ACE_Handler::Proxy_Ptr &handler_proxy,
1041 ACE_HANDLE connect_handle,
1042 const void* act,
1043 ACE_HANDLE event,
1044 int priority,
1045 int signal_number)
1047 return this->implementation ()->create_asynch_connect_result
1048 (handler_proxy,
1049 connect_handle,
1050 act,
1051 event,
1052 priority,
1053 signal_number);
1056 ACE_Asynch_Transmit_File_Result_Impl *
1057 ACE_Proactor::create_asynch_transmit_file_result
1058 (ACE_Handler::Proxy_Ptr &handler_proxy,
1059 ACE_HANDLE socket,
1060 ACE_HANDLE file,
1061 ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer,
1062 u_long bytes_to_write,
1063 u_long offset,
1064 u_long offset_high,
1065 u_long bytes_per_send,
1066 u_long flags,
1067 const void *act,
1068 ACE_HANDLE event,
1069 int priority,
1070 int signal_number)
1072 return this->implementation ()->create_asynch_transmit_file_result
1073 (handler_proxy,
1074 socket,
1075 file,
1076 header_and_trailer,
1077 bytes_to_write,
1078 offset,
1079 offset_high,
1080 bytes_per_send,
1081 flags,
1082 act,
1083 event,
1084 priority,
1085 signal_number);
1088 ACE_Asynch_Result_Impl *
1089 ACE_Proactor::create_asynch_timer
1090 (ACE_Handler::Proxy_Ptr &handler_proxy,
1091 const void *act,
1092 const ACE_Time_Value &tv,
1093 ACE_HANDLE event,
1094 int priority,
1095 int signal_number)
1097 return this->implementation ()->create_asynch_timer
1098 (handler_proxy,
1099 act,
1101 event,
1102 priority,
1103 signal_number);
1107 ACE_Proactor::proactor_post_wakeup_completions (int how_many)
1109 return this->implementation ()->post_wakeup_completions (how_many);
1112 void
1113 ACE_Proactor::implementation (ACE_Proactor_Impl *implementation)
1115 this->implementation_ = implementation;
1118 ACE_END_VERSIONED_NAMESPACE_DECL
1120 #else /* !ACE_WIN32 || !ACE_HAS_AIO_CALLS */
1122 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
1124 ACE_Proactor *
1125 ACE_Proactor::instance (size_t /* threads */)
1127 return 0;
1130 ACE_Proactor *
1131 ACE_Proactor::instance (ACE_Proactor *)
1133 return 0;
1136 void
1137 ACE_Proactor::close_singleton ()
1142 ACE_Proactor::run_event_loop ()
1144 // not implemented
1145 return -1;
1149 ACE_Proactor::run_event_loop (ACE_Time_Value &)
1151 // not implemented
1152 return -1;
1156 ACE_Proactor::end_event_loop ()
1158 // not implemented
1159 return -1;
1162 sig_atomic_t
1163 ACE_Proactor::event_loop_done ()
1165 return sig_atomic_t (1);
1168 ACE_END_VERSIONED_NAMESPACE_DECL
1170 #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */