[7297] Fixed profession spells sorting in trainer spell list at client.
[getmangos.git] / dep / ACE_wrappers / ace / Proactor.cpp
blobf7771aec1141d3bde3a779a5199a03126fb8a276
1 // $Id: Proactor.cpp 81535 2008-04-29 20:08:52Z shuston $
3 #include "ace/config-lite.h"
4 #include "ace/Proactor.h"
5 #if defined (ACE_HAS_WIN32_OVERLAPPED_IO) || defined (ACE_HAS_AIO_CALLS)
7 // This only works on Win32 platforms and on Unix platforms with aio
8 // calls.
10 #include "ace/Auto_Ptr.h"
11 #include "ace/Proactor_Impl.h"
12 #include "ace/Object_Manager.h"
13 #include "ace/Task_T.h"
15 #if !defined (ACE_HAS_WINCE) && !defined (ACE_LACKS_ACE_SVCCONF)
16 # include "ace/Service_Config.h"
17 #endif /* !ACE_HAS_WINCE && !ACE_LACKS_ACE_SVCCONF */
20 ACE_RCSID (ace,
21 Proactor,
22 "$Id: Proactor.cpp 81535 2008-04-29 20:08:52Z shuston $")
25 #include "ace/Task_T.h"
26 #include "ace/Log_Msg.h"
27 #include "ace/Framework_Component.h"
29 #if defined (ACE_HAS_AIO_CALLS)
30 # include "ace/POSIX_Proactor.h"
31 # include "ace/POSIX_CB_Proactor.h"
32 #else /* !ACE_HAS_AIO_CALLS */
33 # include "ace/WIN32_Proactor.h"
34 #endif /* ACE_HAS_AIO_CALLS */
36 #if !defined (__ACE_INLINE__)
37 #include "ace/Proactor.inl"
38 #endif /* __ACE_INLINE__ */
40 #include "ace/Auto_Event.h"
42 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
44 /// Process-wide ACE_Proactor.
45 ACE_Proactor *ACE_Proactor::proactor_ = 0;
47 /// Controls whether the Proactor is deleted when we shut down (we can
48 /// only delete it safely if we created it!)
49 bool ACE_Proactor::delete_proactor_ = false;
51 /**
52 * @class ACE_Proactor_Timer_Handler
54 * @brief A Handler for timer. It helps in the management of timers
55 * registered with the Proactor.
57 * This object has a thread that will wait on the earliest time
58 * in a list of timers and an event. When a timer expires, the
59 * thread will post a completion event on the port and go back
60 * to waiting on the timer queue and event. If the event is
61 * signaled, the thread will refresh the time it is currently
62 * waiting on (in case the earliest time has changed).
64 class ACE_Proactor_Timer_Handler : public ACE_Task<ACE_NULL_SYNCH>
67 /// Proactor has special privileges
68 /// Access needed to: timer_event_
69 friend class ACE_Proactor;
71 public:
72 /// Constructor.
73 ACE_Proactor_Timer_Handler (ACE_Proactor &proactor);
75 /// Destructor.
76 virtual ~ACE_Proactor_Timer_Handler (void);
78 /// Proactor calls this to shut down the timer handler
79 /// gracefully. Just calling the destructor alone doesnt do what
80 /// <destroy> does. <destroy> make sure the thread exits properly.
81 int destroy (void);
83 protected:
84 /// Run by a daemon thread to handle deferred processing. In other
85 /// words, this method will do the waiting on the earliest timer and
86 /// event.
87 virtual int svc (void);
89 /// Event to wait on.
90 ACE_Auto_Event timer_event_;
92 /// Proactor.
93 ACE_Proactor &proactor_;
95 /// Flag used to indicate when we are shutting down.
96 int shutting_down_;
99 ACE_Proactor_Timer_Handler::ACE_Proactor_Timer_Handler (ACE_Proactor &proactor)
100 : ACE_Task <ACE_NULL_SYNCH> (&proactor.thr_mgr_),
101 proactor_ (proactor),
102 shutting_down_ (0)
106 ACE_Proactor_Timer_Handler::~ACE_Proactor_Timer_Handler (void)
108 // Mark for closing down.
109 this->shutting_down_ = 1;
111 // Signal timer event.
112 this->timer_event_.signal ();
114 // Wait for the Timer Handler thread to exit.
115 this->wait ();
119 ACE_Proactor_Timer_Handler::svc (void)
121 ACE_Time_Value absolute_time;
122 ACE_Time_Value relative_time;
123 int result = 0;
125 while (this->shutting_down_ == 0)
127 // Check whether the timer queue has any items in it.
128 if (this->proactor_.timer_queue ()->is_empty () == 0)
130 // Get the earliest absolute time.
131 absolute_time = this->proactor_.timer_queue ()->earliest_time ();
133 // Get current time from timer queue since we don't know
134 // which <gettimeofday> was used.
135 ACE_Time_Value cur_time = this->proactor_.timer_queue ()->gettimeofday ();
137 // Compare absolute time with curent time received from the
138 // timer queue.
139 if (absolute_time > cur_time)
140 relative_time = absolute_time - cur_time;
141 else
142 relative_time = ACE_Time_Value::zero;
144 // Block for relative time.
145 result = this->timer_event_.wait (&relative_time, 0);
147 else
148 // The timer queue has no entries, so wait indefinitely.
149 result = this->timer_event_.wait ();
151 // Check for timer expiries.
152 if (result == -1)
154 switch (errno)
156 case ETIME:
157 // timeout: expire timers
158 this->proactor_.timer_queue ()->expire ();
159 break;
160 default:
161 // Error.
162 ACE_ERROR_RETURN ((LM_ERROR,
163 ACE_TEXT ("%N:%l:(%P | %t):%p\n"),
164 ACE_TEXT ("ACE_Proactor_Timer_Handler::svc:wait failed")),
165 -1);
169 return 0;
172 // *********************************************************************
174 ACE_Proactor_Handle_Timeout_Upcall::ACE_Proactor_Handle_Timeout_Upcall (void)
175 : proactor_ (0)
180 ACE_Proactor_Handle_Timeout_Upcall::registration (TIMER_QUEUE &,
181 ACE_Handler *,
182 const void *)
184 return 0;
188 ACE_Proactor_Handle_Timeout_Upcall::preinvoke (TIMER_QUEUE &,
189 ACE_Handler *,
190 const void *,
191 int,
192 const ACE_Time_Value &,
193 const void *&)
195 return 0;
199 ACE_Proactor_Handle_Timeout_Upcall::postinvoke (TIMER_QUEUE &,
200 ACE_Handler *,
201 const void *,
202 int,
203 const ACE_Time_Value &,
204 const void *)
206 return 0;
210 ACE_Proactor_Handle_Timeout_Upcall::timeout (TIMER_QUEUE &,
211 ACE_Handler *handler,
212 const void *act,
213 int,
214 const ACE_Time_Value &time)
216 if (this->proactor_ == 0)
217 ACE_ERROR_RETURN ((LM_ERROR,
218 ACE_TEXT ("(%t) No Proactor set in ACE_Proactor_Handle_Timeout_Upcall,")
219 ACE_TEXT (" no completion port to post timeout to?!@\n")),
220 -1);
222 // Create the Asynch_Timer.
223 ACE_Asynch_Result_Impl *asynch_timer =
224 this->proactor_->create_asynch_timer (handler->proxy (),
225 act,
226 time,
227 ACE_INVALID_HANDLE,
229 -1);
231 if (asynch_timer == 0)
232 ACE_ERROR_RETURN ((LM_ERROR,
233 ACE_TEXT ("%N:%l:(%P | %t):%p\n"),
234 ACE_TEXT ("ACE_Proactor_Handle_Timeout_Upcall::timeout:")
235 ACE_TEXT ("create_asynch_timer failed")),
236 -1);
238 auto_ptr<ACE_Asynch_Result_Impl> safe_asynch_timer (asynch_timer);
240 // Post a completion.
241 if (-1 == safe_asynch_timer->post_completion
242 (this->proactor_->implementation ()))
243 ACE_ERROR_RETURN ((LM_ERROR,
244 ACE_TEXT ("Failure in dealing with timers: ")
245 ACE_TEXT ("PostQueuedCompletionStatus failed\n")),
246 -1);
248 // The completion has been posted. The proactor is now responsible
249 // for managing the asynch_timer memory.
250 (void) safe_asynch_timer.release ();
252 return 0;
256 ACE_Proactor_Handle_Timeout_Upcall::cancel_type (TIMER_QUEUE &,
257 ACE_Handler *,
258 int,
259 int &)
261 // Do nothing
262 return 0;
266 ACE_Proactor_Handle_Timeout_Upcall::cancel_timer (TIMER_QUEUE &,
267 ACE_Handler *,
268 int,
269 int)
271 // Do nothing
272 return 0;
276 ACE_Proactor_Handle_Timeout_Upcall::deletion (TIMER_QUEUE &,
277 ACE_Handler *,
278 const void *)
280 // Do nothing
281 return 0;
285 ACE_Proactor_Handle_Timeout_Upcall::proactor (ACE_Proactor &proactor)
287 if (this->proactor_ == 0)
289 this->proactor_ = &proactor;
290 return 0;
292 else
293 ACE_ERROR_RETURN ((LM_ERROR,
294 ACE_TEXT ("ACE_Proactor_Handle_Timeout_Upcall is only suppose")
295 ACE_TEXT (" to be used with ONE (and only one) Proactor\n")),
296 -1);
299 // *********************************************************************
301 ACE_Proactor::ACE_Proactor (ACE_Proactor_Impl *implementation,
302 bool delete_implementation,
303 TIMER_QUEUE *tq)
304 : implementation_ (0),
305 delete_implementation_ (delete_implementation),
306 timer_handler_ (0),
307 timer_queue_ (0),
308 delete_timer_queue_ (0),
309 end_event_loop_ (0),
310 event_loop_thread_count_ (0)
312 this->implementation (implementation);
314 if (this->implementation () == 0)
316 #if defined (ACE_HAS_AIO_CALLS)
317 // POSIX Proactor.
318 # if defined (ACE_POSIX_AIOCB_PROACTOR)
319 ACE_NEW (implementation, ACE_POSIX_AIOCB_Proactor);
320 # elif defined (ACE_POSIX_SIG_PROACTOR)
321 ACE_NEW (implementation, ACE_POSIX_SIG_Proactor);
322 # else /* Default order: CB, SIG, AIOCB */
323 # if !defined(ACE_HAS_BROKEN_SIGEVENT_STRUCT)
324 ACE_NEW (implementation, ACE_POSIX_CB_Proactor);
325 # else
326 # if defined(ACE_HAS_POSIX_REALTIME_SIGNALS)
327 ACE_NEW (implementation, ACE_POSIX_SIG_Proactor);
328 # else
329 ACE_NEW (implementation, ACE_POSIX_AIOCB_Proactor);
330 # endif /* ACE_HAS_POSIX_REALTIME_SIGNALS */
331 # endif /* !ACE_HAS_BROKEN_SIGEVENT_STRUCT */
332 # endif /* ACE_POSIX_AIOCB_PROACTOR */
333 #elif (defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
334 // WIN_Proactor.
335 ACE_NEW (implementation,
336 ACE_WIN32_Proactor);
337 #endif /* ACE_HAS_AIO_CALLS */
338 this->implementation (implementation);
339 this->delete_implementation_ = true;
342 // Set the timer queue.
343 this->timer_queue (tq);
345 // Create the timer handler
346 ACE_NEW (this->timer_handler_,
347 ACE_Proactor_Timer_Handler (*this));
349 // Activate <timer_handler>.
350 if (this->timer_handler_->activate () == -1)
351 ACE_ERROR ((LM_ERROR,
352 ACE_TEXT ("%N:%l:(%P | %t):%p\n"),
353 ACE_TEXT ("Task::activate:could not create thread\n")));
356 ACE_Proactor::~ACE_Proactor (void)
358 this->close ();
361 ACE_Proactor *
362 ACE_Proactor::instance (size_t /* threads */)
364 ACE_TRACE ("ACE_Proactor::instance");
366 if (ACE_Proactor::proactor_ == 0)
368 // Perform Double-Checked Locking Optimization.
369 ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
370 *ACE_Static_Object_Lock::instance (),
371 0));
373 if (ACE_Proactor::proactor_ == 0)
375 ACE_NEW_RETURN (ACE_Proactor::proactor_,
376 ACE_Proactor,
379 ACE_Proactor::delete_proactor_ = true;
380 ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Proactor, ACE_Proactor::proactor_);
383 return ACE_Proactor::proactor_;
386 ACE_Proactor *
387 ACE_Proactor::instance (ACE_Proactor * r, bool delete_proactor)
389 ACE_TRACE ("ACE_Proactor::instance");
391 ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon,
392 *ACE_Static_Object_Lock::instance (), 0));
394 ACE_Proactor *t = ACE_Proactor::proactor_;
396 ACE_Proactor::delete_proactor_ = delete_proactor;
397 ACE_Proactor::proactor_ = r;
398 ACE_REGISTER_FRAMEWORK_COMPONENT(ACE_Proactor, ACE_Proactor::proactor_);
400 return t;
403 void
404 ACE_Proactor::close_singleton (void)
406 ACE_TRACE ("ACE_Proactor::close_singleton");
408 ACE_MT (ACE_GUARD (ACE_Recursive_Thread_Mutex, ace_mon,
409 *ACE_Static_Object_Lock::instance ()));
411 if (ACE_Proactor::delete_proactor_)
413 delete ACE_Proactor::proactor_;
414 ACE_Proactor::proactor_ = 0;
415 ACE_Proactor::delete_proactor_ = false;
419 const ACE_TCHAR *
420 ACE_Proactor::dll_name (void)
422 return ACE_TEXT ("ACE");
425 const ACE_TCHAR *
426 ACE_Proactor::name (void)
428 return ACE_TEXT ("ACE_Proactor");
432 ACE_Proactor::check_reconfiguration (ACE_Proactor *)
434 #if !defined (ACE_HAS_WINCE) && !defined (ACE_LACKS_ACE_SVCCONF)
435 if (ACE_Service_Config::reconfig_occurred ())
437 ACE_Service_Config::reconfigure ();
438 return 1;
440 #endif /* ! ACE_HAS_WINCE || ! ACE_LACKS_ACE_SVCCONF */
441 return 0;
445 ACE_Proactor::proactor_run_event_loop (PROACTOR_EVENT_HOOK eh)
447 ACE_TRACE ("ACE_Proactor::proactor_run_event_loop");
448 int result = 0;
451 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
453 // Early check. It is ok to do this without lock, since we care just
454 // whether it is zero or non-zero.
455 if (this->end_event_loop_ != 0)
456 return 0;
458 // First time you are in. Increment the thread count.
459 this->event_loop_thread_count_ ++;
462 // Run the event loop.
463 for (;;)
465 // Check the end loop flag. It is ok to do this without lock,
466 // since we care just whether it is zero or non-zero.
467 if (this->end_event_loop_ != 0)
468 break;
470 // <end_event_loop> is not set. Ready to do <handle_events>.
471 result = this->handle_events ();
473 if (eh != 0 && (*eh) (this))
474 continue;
476 if (result == -1)
477 break;
480 // Leaving the event loop. Decrement the thread count.
483 // Obtain the lock in the MT environments.
484 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
486 // Decrement the thread count.
487 this->event_loop_thread_count_ --;
489 if (this->event_loop_thread_count_ > 0
490 && this->end_event_loop_ != 0)
491 this->proactor_post_wakeup_completions (1);
494 return result;
497 // Handle events for -tv- time. handle_events updates -tv- to reflect
498 // time elapsed, so do not return until -tv- == 0, or an error occurs.
500 ACE_Proactor::proactor_run_event_loop (ACE_Time_Value &tv,
501 PROACTOR_EVENT_HOOK eh)
503 ACE_TRACE ("ACE_Proactor::proactor_run_event_loop");
504 int result = 0;
507 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
509 // Early check. It is ok to do this without lock, since we care just
510 // whether it is zero or non-zero.
511 if (this->end_event_loop_ != 0
512 || tv == ACE_Time_Value::zero)
513 return 0;
515 // First time you are in. Increment the thread count.
516 this->event_loop_thread_count_ ++;
519 // Run the event loop.
520 for (;;)
522 // Check the end loop flag. It is ok to do this without lock,
523 // since we care just whether it is zero or non-zero.
524 if (this->end_event_loop_ != 0)
525 break;
527 // <end_event_loop> is not set. Ready to do <handle_events>.
528 result = this->handle_events (tv);
530 if (eh != 0 && (*eh) (this))
531 continue;
533 if (result == -1 || result == 0)
534 break;
537 // Leaving the event loop. Decrement the thread count.
540 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
542 // Decrement the thread count.
543 this->event_loop_thread_count_ --;
545 if (this->event_loop_thread_count_ > 0
546 && this->end_event_loop_ != 0)
547 this->proactor_post_wakeup_completions (1);
550 return result;
554 ACE_Proactor::proactor_reset_event_loop(void)
556 ACE_TRACE ("ACE_Proactor::proactor_reset_event_loop");
558 // Obtain the lock in the MT environments.
559 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
561 this->end_event_loop_ = 0;
562 return 0;
566 ACE_Proactor::proactor_end_event_loop (void)
568 ACE_TRACE ("ACE_Proactor::proactor_end_event_loop");
570 int how_many = 0;
573 // Obtain the lock, set the end flag and post the wakeup
574 // completions.
575 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
577 // Set the end flag.
578 this->end_event_loop_ = 1;
580 // Number of completions to post.
581 how_many = this->event_loop_thread_count_;
582 if (how_many == 0)
583 return 0;
586 // Post completions to all the threads so that they will all wake
587 // up.
588 return this->proactor_post_wakeup_completions (how_many);
592 ACE_Proactor::proactor_event_loop_done (void)
594 ACE_TRACE ("ACE_Proactor::proactor_event_loop_done");
596 ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, mutex_, -1));
598 return this->end_event_loop_ != 0 ? 1 : 0 ;
602 ACE_Proactor::close (void)
604 // Close the implementation.
605 if (this->implementation ()->close () == -1)
606 ACE_ERROR ((LM_ERROR,
607 ACE_TEXT ("%N:%l:(%P | %t):%p\n"),
608 ACE_TEXT ("ACE_Proactor::close: implementation close")));
610 // Delete the implementation.
611 if (this->delete_implementation_)
613 delete this->implementation ();
614 this->implementation_ = 0;
617 // Delete the timer handler.
618 if (this->timer_handler_)
620 delete this->timer_handler_;
621 this->timer_handler_ = 0;
624 // Delete the timer queue.
625 if (this->delete_timer_queue_)
627 delete this->timer_queue_;
628 this->timer_queue_ = 0;
629 this->delete_timer_queue_ = 0;
632 return 0;
636 ACE_Proactor::register_handle (ACE_HANDLE handle,
637 const void *completion_key)
639 return this->implementation ()->register_handle (handle,
640 completion_key);
643 long
644 ACE_Proactor::schedule_timer (ACE_Handler &handler,
645 const void *act,
646 const ACE_Time_Value &time)
648 return this->schedule_timer (handler,
649 act,
650 time,
651 ACE_Time_Value::zero);
654 long
655 ACE_Proactor::schedule_repeating_timer (ACE_Handler &handler,
656 const void *act,
657 const ACE_Time_Value &interval)
659 return this->schedule_timer (handler,
660 act,
661 interval,
662 interval);
665 long
666 ACE_Proactor::schedule_timer (ACE_Handler &handler,
667 const void *act,
668 const ACE_Time_Value &time,
669 const ACE_Time_Value &interval)
671 // absolute time.
672 ACE_Time_Value absolute_time =
673 this->timer_queue_->gettimeofday () + time;
675 // Only one guy goes in here at a time
676 ACE_MT (ACE_GUARD_RETURN (ACE_SYNCH_RECURSIVE_MUTEX,
677 ace_mon,
678 this->timer_queue_->mutex (),
679 -1));
681 // Remember the old proactor.
682 ACE_Proactor *old_proactor = handler.proactor ();
684 // Assign *this* Proactor to the handler.
685 handler.proactor (this);
687 // Schedule the timer
688 long result = this->timer_queue_->schedule (&handler,
689 act,
690 absolute_time,
691 interval);
692 if (result != -1)
694 // no failures: check to see if we are the earliest time
695 if (this->timer_queue_->earliest_time () == absolute_time)
697 // wake up the timer thread
698 if (this->timer_handler_->timer_event_.signal () == -1)
700 // Cancel timer
701 this->timer_queue_->cancel (result);
702 result = -1;
706 if (result == -1)
708 // Reset the old proactor in case of failures.
709 handler.proactor (old_proactor);
712 return result;
716 ACE_Proactor::cancel_timer (long timer_id,
717 const void **arg,
718 int dont_call_handle_close)
720 // No need to singal timer event here. Even if the cancel timer was
721 // the earliest, we will have an extra wakeup.
722 return this->timer_queue_->cancel (timer_id,
723 arg,
724 dont_call_handle_close);
728 ACE_Proactor::cancel_timer (ACE_Handler &handler,
729 int dont_call_handle_close)
731 // No need to signal timer event here. Even if the cancel timer was
732 // the earliest, we will have an extra wakeup.
733 return this->timer_queue_->cancel (&handler,
734 dont_call_handle_close);
738 ACE_Proactor::handle_events (ACE_Time_Value &wait_time)
740 return implementation ()->handle_events (wait_time);
744 ACE_Proactor::handle_events (void)
746 return this->implementation ()->handle_events ();
750 ACE_Proactor::wake_up_dispatch_threads (void)
752 return 0;
756 ACE_Proactor::close_dispatch_threads (int)
758 return 0;
761 size_t
762 ACE_Proactor::number_of_threads (void) const
764 return this->implementation ()->number_of_threads ();
767 void
768 ACE_Proactor::number_of_threads (size_t threads)
770 this->implementation ()->number_of_threads (threads);
773 ACE_Proactor::TIMER_QUEUE *
774 ACE_Proactor::timer_queue (void) const
776 return this->timer_queue_;
779 void
780 ACE_Proactor::timer_queue (TIMER_QUEUE *tq)
782 // Cleanup old timer queue.
783 if (this->delete_timer_queue_)
785 delete this->timer_queue_;
786 this->delete_timer_queue_ = 0;
789 // New timer queue.
790 if (tq == 0)
792 ACE_NEW (this->timer_queue_,
793 TIMER_HEAP);
794 this->delete_timer_queue_ = 1;
796 else
798 this->timer_queue_ = tq;
799 this->delete_timer_queue_ = 0;
802 // Set the proactor in the timer queue's functor
803 this->timer_queue_->upcall_functor ().proactor (*this);
806 ACE_HANDLE
807 ACE_Proactor::get_handle (void) const
809 return this->implementation ()->get_handle ();
812 ACE_Proactor_Impl *
813 ACE_Proactor::implementation (void) const
815 return this->implementation_;
819 ACE_Asynch_Read_Stream_Impl *
820 ACE_Proactor::create_asynch_read_stream (void)
822 return this->implementation ()->create_asynch_read_stream ();
825 ACE_Asynch_Write_Stream_Impl *
826 ACE_Proactor::create_asynch_write_stream (void)
828 return this->implementation ()->create_asynch_write_stream ();
831 ACE_Asynch_Read_Dgram_Impl *
832 ACE_Proactor::create_asynch_read_dgram (void)
834 return this->implementation ()->create_asynch_read_dgram ();
837 ACE_Asynch_Write_Dgram_Impl *
838 ACE_Proactor::create_asynch_write_dgram (void)
840 return this->implementation ()->create_asynch_write_dgram ();
843 ACE_Asynch_Read_File_Impl *
844 ACE_Proactor::create_asynch_read_file (void)
846 return this->implementation ()->create_asynch_read_file ();
849 ACE_Asynch_Write_File_Impl *
850 ACE_Proactor::create_asynch_write_file (void)
852 return this->implementation ()->create_asynch_write_file ();
855 ACE_Asynch_Accept_Impl *
856 ACE_Proactor::create_asynch_accept (void)
858 return this->implementation ()->create_asynch_accept ();
861 ACE_Asynch_Connect_Impl *
862 ACE_Proactor::create_asynch_connect (void)
864 return this->implementation ()->create_asynch_connect ();
867 ACE_Asynch_Transmit_File_Impl *
868 ACE_Proactor::create_asynch_transmit_file (void)
870 return this->implementation ()->create_asynch_transmit_file ();
873 ACE_Asynch_Read_Stream_Result_Impl *
874 ACE_Proactor::create_asynch_read_stream_result
875 (ACE_Handler::Proxy_Ptr &handler_proxy,
876 ACE_HANDLE handle,
877 ACE_Message_Block &message_block,
878 u_long bytes_to_read,
879 const void* act,
880 ACE_HANDLE event,
881 int priority,
882 int signal_number)
884 return this->implementation ()->create_asynch_read_stream_result
885 (handler_proxy,
886 handle,
887 message_block,
888 bytes_to_read,
889 act,
890 event,
891 priority,
892 signal_number);
896 ACE_Asynch_Write_Stream_Result_Impl *
897 ACE_Proactor::create_asynch_write_stream_result
898 (ACE_Handler::Proxy_Ptr &handler_proxy,
899 ACE_HANDLE handle,
900 ACE_Message_Block &message_block,
901 u_long bytes_to_write,
902 const void* act,
903 ACE_HANDLE event,
904 int priority,
905 int signal_number)
907 return this->implementation ()->create_asynch_write_stream_result
908 (handler_proxy,
909 handle,
910 message_block,
911 bytes_to_write,
912 act,
913 event,
914 priority,
915 signal_number);
918 ACE_Asynch_Read_File_Result_Impl *
919 ACE_Proactor::create_asynch_read_file_result
920 (ACE_Handler::Proxy_Ptr &handler_proxy,
921 ACE_HANDLE handle,
922 ACE_Message_Block &message_block,
923 u_long bytes_to_read,
924 const void* act,
925 u_long offset,
926 u_long offset_high,
927 ACE_HANDLE event,
928 int priority,
929 int signal_number)
931 return this->implementation ()->create_asynch_read_file_result
932 (handler_proxy,
933 handle,
934 message_block,
935 bytes_to_read,
936 act,
937 offset,
938 offset_high,
939 event,
940 priority,
941 signal_number);
944 ACE_Asynch_Write_File_Result_Impl *
945 ACE_Proactor::create_asynch_write_file_result
946 (ACE_Handler::Proxy_Ptr &handler_proxy,
947 ACE_HANDLE handle,
948 ACE_Message_Block &message_block,
949 u_long bytes_to_write,
950 const void* act,
951 u_long offset,
952 u_long offset_high,
953 ACE_HANDLE event,
954 int priority,
955 int signal_number)
957 return this->implementation ()->create_asynch_write_file_result
958 (handler_proxy,
959 handle,
960 message_block,
961 bytes_to_write,
962 act,
963 offset,
964 offset_high,
965 event,
966 priority,
967 signal_number);
970 ACE_Asynch_Read_Dgram_Result_Impl *
971 ACE_Proactor::create_asynch_read_dgram_result
972 (ACE_Handler::Proxy_Ptr &handler_proxy,
973 ACE_HANDLE handle,
974 ACE_Message_Block *message_block,
975 size_t bytes_to_read,
976 int flags,
977 int protocol_family,
978 const void* act,
979 ACE_HANDLE event,
980 int priority,
981 int signal_number)
983 return this->implementation()->create_asynch_read_dgram_result
984 (handler_proxy,
985 handle,
986 message_block,
987 bytes_to_read,
988 flags,
989 protocol_family,
990 act,
991 event,
992 priority,
993 signal_number);
996 ACE_Asynch_Write_Dgram_Result_Impl *
997 ACE_Proactor::create_asynch_write_dgram_result
998 (ACE_Handler::Proxy_Ptr &handler_proxy,
999 ACE_HANDLE handle,
1000 ACE_Message_Block *message_block,
1001 size_t bytes_to_write,
1002 int flags,
1003 const void* act,
1004 ACE_HANDLE event,
1005 int priority,
1006 int signal_number)
1008 return this->implementation()->create_asynch_write_dgram_result
1009 (handler_proxy,
1010 handle,
1011 message_block,
1012 bytes_to_write,
1013 flags,
1014 act,
1015 event,
1016 priority,
1017 signal_number);
1020 ACE_Asynch_Accept_Result_Impl *
1021 ACE_Proactor::create_asynch_accept_result
1022 (ACE_Handler::Proxy_Ptr &handler_proxy,
1023 ACE_HANDLE listen_handle,
1024 ACE_HANDLE accept_handle,
1025 ACE_Message_Block &message_block,
1026 u_long bytes_to_read,
1027 const void* act,
1028 ACE_HANDLE event,
1029 int priority,
1030 int signal_number)
1032 return this->implementation ()->create_asynch_accept_result
1033 (handler_proxy,
1034 listen_handle,
1035 accept_handle,
1036 message_block,
1037 bytes_to_read,
1038 act,
1039 event,
1040 priority,
1041 signal_number);
1044 ACE_Asynch_Connect_Result_Impl *
1045 ACE_Proactor::create_asynch_connect_result
1046 (ACE_Handler::Proxy_Ptr &handler_proxy,
1047 ACE_HANDLE connect_handle,
1048 const void* act,
1049 ACE_HANDLE event,
1050 int priority,
1051 int signal_number)
1053 return this->implementation ()->create_asynch_connect_result
1054 (handler_proxy,
1055 connect_handle,
1056 act,
1057 event,
1058 priority,
1059 signal_number);
1062 ACE_Asynch_Transmit_File_Result_Impl *
1063 ACE_Proactor::create_asynch_transmit_file_result
1064 (ACE_Handler::Proxy_Ptr &handler_proxy,
1065 ACE_HANDLE socket,
1066 ACE_HANDLE file,
1067 ACE_Asynch_Transmit_File::Header_And_Trailer *header_and_trailer,
1068 u_long bytes_to_write,
1069 u_long offset,
1070 u_long offset_high,
1071 u_long bytes_per_send,
1072 u_long flags,
1073 const void *act,
1074 ACE_HANDLE event,
1075 int priority,
1076 int signal_number)
1078 return this->implementation ()->create_asynch_transmit_file_result
1079 (handler_proxy,
1080 socket,
1081 file,
1082 header_and_trailer,
1083 bytes_to_write,
1084 offset,
1085 offset_high,
1086 bytes_per_send,
1087 flags,
1088 act,
1089 event,
1090 priority,
1091 signal_number);
1094 ACE_Asynch_Result_Impl *
1095 ACE_Proactor::create_asynch_timer
1096 (ACE_Handler::Proxy_Ptr &handler_proxy,
1097 const void *act,
1098 const ACE_Time_Value &tv,
1099 ACE_HANDLE event,
1100 int priority,
1101 int signal_number)
1103 return this->implementation ()->create_asynch_timer
1104 (handler_proxy,
1105 act,
1107 event,
1108 priority,
1109 signal_number);
1113 ACE_Proactor::proactor_post_wakeup_completions (int how_many)
1115 return this->implementation ()->post_wakeup_completions (how_many);
1118 void
1119 ACE_Proactor::implementation (ACE_Proactor_Impl *implementation)
1121 this->implementation_ = implementation;
1124 ACE_END_VERSIONED_NAMESPACE_DECL
1126 #else /* !ACE_WIN32 || !ACE_HAS_AIO_CALLS */
1128 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
1130 ACE_Proactor *
1131 ACE_Proactor::instance (size_t /* threads */)
1133 return 0;
1136 ACE_Proactor *
1137 ACE_Proactor::instance (ACE_Proactor *)
1139 return 0;
1142 void
1143 ACE_Proactor::close_singleton (void)
1148 ACE_Proactor::run_event_loop (void)
1150 // not implemented
1151 return -1;
1155 ACE_Proactor::run_event_loop (ACE_Time_Value &)
1157 // not implemented
1158 return -1;
1162 ACE_Proactor::end_event_loop (void)
1164 // not implemented
1165 return -1;
1168 sig_atomic_t
1169 ACE_Proactor::event_loop_done (void)
1171 return sig_atomic_t (1);
1174 ACE_END_VERSIONED_NAMESPACE_DECL
1176 #endif /* ACE_HAS_WIN32_OVERLAPPED_IO || ACE_HAS_AIO_CALLS */