00001
00002
00003
00004 #include "ace/Reactor_Impl.h"
00005 #include "ace/Handle_Set.h"
00006
00007 ACE_INLINE ACE_Reactor_Impl *
00008 ACE_Reactor::implementation (void) const
00009 {
00010 return this->implementation_;
00011 }
00012
00013 ACE_INLINE void
00014 ACE_Reactor::implementation (ACE_Reactor_Impl *impl)
00015 {
00016 this->implementation_ = impl;
00017 }
00018
00019 ACE_INLINE int
00020 ACE_Reactor::current_info (ACE_HANDLE handle,
00021 size_t &size)
00022 {
00023 return this->implementation ()->current_info (handle, size);
00024 }
00025
00026
00027
00028
00029 ACE_INLINE int
00030 ACE_Reactor::run_event_loop (void)
00031 {
00032 ACE_TRACE ("ACE_Reactor::run_event_loop");
00033 ACE_Reactor *r = ACE_Reactor::instance ();
00034
00035 if (r == 0)
00036 return -1;
00037
00038 return r->run_reactor_event_loop (ACE_Reactor::check_reconfiguration);
00039 }
00040
00041
00042
00043
00044
00045 ACE_INLINE int
00046 ACE_Reactor::run_event_loop (ACE_Time_Value &tv)
00047 {
00048 ACE_TRACE ("ACE_Reactor::run_event_loop");
00049 ACE_Reactor *r = ACE_Reactor::instance ();
00050
00051 if (r == 0)
00052 return -1;
00053
00054 return r->run_reactor_event_loop
00055 (tv, ACE_Reactor::check_reconfiguration);
00056 }
00057
00058
00059
00060
00061 ACE_INLINE int
00062 ACE_Reactor::run_alertable_event_loop (void)
00063 {
00064 ACE_TRACE ("ACE_Reactor::run_alertable_event_loop");
00065 ACE_Reactor *r = ACE_Reactor::instance ();
00066
00067 if (r == 0)
00068 return -1;
00069
00070 return r->run_alertable_reactor_event_loop (ACE_Reactor::check_reconfiguration);
00071 }
00072
00073
00074
00075
00076
00077 ACE_INLINE int
00078 ACE_Reactor::run_alertable_event_loop (ACE_Time_Value &tv)
00079 {
00080 ACE_TRACE ("ACE_Reactor::run_alertable_event_loop");
00081 ACE_Reactor *r = ACE_Reactor::instance ();
00082
00083 if (r == 0)
00084 return -1;
00085
00086 return r->run_alertable_reactor_event_loop
00087 (tv, ACE_Reactor::check_reconfiguration);
00088 }
00089
00090 ACE_INLINE void
00091 ACE_Reactor::reset_event_loop (void)
00092 {
00093 ACE_TRACE ("ACE_Reactor::reset_event_loop");
00094
00095 ACE_Reactor::instance ()->reset_reactor_event_loop ();
00096 }
00097
00098 ACE_INLINE int
00099 ACE_Reactor::end_event_loop (void)
00100 {
00101 ACE_TRACE ("ACE_Reactor::end_event_loop");
00102 ACE_Reactor::instance ()->end_reactor_event_loop ();
00103
00104 return 0;
00105 }
00106
00107 ACE_INLINE int
00108 ACE_Reactor::reactor_event_loop_done (void)
00109 {
00110 ACE_TRACE ("ACE_Reactor::reactor_event_loop_done");
00111 return this->implementation_->deactivated ();
00112 }
00113
00114 ACE_INLINE int
00115 ACE_Reactor::event_loop_done (void)
00116 {
00117 ACE_TRACE ("ACE_Reactor::event_loop_done");
00118 return ACE_Reactor::instance ()->reactor_event_loop_done ();
00119 }
00120
00121 ACE_INLINE int
00122 ACE_Reactor::open (size_t size,
00123 int restart,
00124 ACE_Sig_Handler *signal_handler,
00125 ACE_Timer_Queue *timer_queue)
00126 {
00127 return this->implementation ()->open (size,
00128 restart,
00129 signal_handler,
00130 timer_queue);
00131 }
00132 ACE_INLINE int
00133 ACE_Reactor::set_sig_handler (ACE_Sig_Handler *signal_handler)
00134 {
00135 return this->implementation ()->set_sig_handler (signal_handler);
00136 }
00137
00138 ACE_INLINE int
00139 ACE_Reactor::timer_queue (ACE_Timer_Queue *tq)
00140 {
00141 return this->implementation ()->timer_queue (tq);
00142 }
00143
00144 ACE_INLINE int
00145 ACE_Reactor::set_timer_queue (ACE_Timer_Queue *tq)
00146 {
00147 return this->timer_queue (tq);
00148 }
00149
00150 ACE_INLINE ACE_Timer_Queue *
00151 ACE_Reactor::timer_queue (void) const
00152 {
00153 ACE_Reactor_Impl *impl = this->implementation_;
00154 return impl->timer_queue ();
00155 }
00156
00157 ACE_INLINE int
00158 ACE_Reactor::close (void)
00159 {
00160 return this->implementation ()->close ();
00161 }
00162
00163 ACE_INLINE int
00164 ACE_Reactor::work_pending (const ACE_Time_Value &max_wait_time)
00165 {
00166 return this->implementation ()->work_pending (max_wait_time);
00167 }
00168
00169 ACE_INLINE int
00170 ACE_Reactor::handle_events (ACE_Time_Value *max_wait_time)
00171 {
00172 return this->implementation ()->handle_events (max_wait_time);
00173 }
00174
00175 ACE_INLINE int
00176 ACE_Reactor::alertable_handle_events (ACE_Time_Value *max_wait_time)
00177 {
00178 return this->implementation ()->alertable_handle_events (max_wait_time);
00179 }
00180
00181 ACE_INLINE int
00182 ACE_Reactor::handle_events (ACE_Time_Value &max_wait_time)
00183 {
00184 return this->implementation ()->handle_events (max_wait_time);
00185 }
00186
00187 ACE_INLINE int
00188 ACE_Reactor::alertable_handle_events (ACE_Time_Value &max_wait_time)
00189 {
00190 return this->implementation ()->alertable_handle_events (max_wait_time);
00191 }
00192
00193
00194 ACE_INLINE int
00195 ACE_Reactor::register_handler (ACE_Event_Handler *event_handler,
00196 ACE_Reactor_Mask mask)
00197 {
00198
00199 ACE_Reactor *old_reactor = event_handler->reactor ();
00200
00201
00202 event_handler->reactor (this);
00203
00204 int result = this->implementation ()->register_handler (event_handler,
00205 mask);
00206 if (result == -1)
00207
00208 event_handler->reactor (old_reactor);
00209
00210 return result;
00211 }
00212
00213 ACE_INLINE int
00214 ACE_Reactor::register_handler (ACE_HANDLE io_handle,
00215 ACE_Event_Handler *event_handler,
00216 ACE_Reactor_Mask mask)
00217 {
00218
00219 ACE_Reactor *old_reactor = event_handler->reactor ();
00220
00221
00222 event_handler->reactor (this);
00223
00224 int result = this->implementation ()->register_handler (io_handle,
00225 event_handler,
00226 mask);
00227 if (result == -1)
00228
00229 event_handler->reactor (old_reactor);
00230
00231 return result;
00232 }
00233
00234 #if defined (ACE_WIN32)
00235
00236 ACE_INLINE int
00237 ACE_Reactor::register_handler (ACE_Event_Handler *event_handler,
00238 ACE_HANDLE event_handle)
00239 {
00240
00241 ACE_Reactor *old_reactor = event_handler->reactor ();
00242
00243
00244 event_handler->reactor (this);
00245
00246 int result = this->implementation ()->register_handler (event_handler,
00247 event_handle);
00248 if (result == -1)
00249
00250 event_handler->reactor (old_reactor);
00251
00252 return result;
00253 }
00254
00255 #endif
00256
00257 ACE_INLINE int
00258 ACE_Reactor::register_handler (ACE_HANDLE event_handle,
00259 ACE_HANDLE io_handle,
00260 ACE_Event_Handler *event_handler,
00261 ACE_Reactor_Mask mask)
00262 {
00263
00264 ACE_Reactor *old_reactor = event_handler->reactor ();
00265
00266
00267 event_handler->reactor (this);
00268
00269 int result = this->implementation ()->register_handler (event_handle,
00270 io_handle,
00271 event_handler,
00272 mask);
00273 if (result == -1)
00274
00275 event_handler->reactor (old_reactor);
00276
00277 return result;
00278 }
00279
00280 ACE_INLINE int
00281 ACE_Reactor::register_handler (const ACE_Handle_Set &handles,
00282 ACE_Event_Handler *event_handler,
00283 ACE_Reactor_Mask mask)
00284 {
00285
00286 ACE_Reactor *old_reactor = event_handler->reactor ();
00287
00288
00289 event_handler->reactor (this);
00290
00291 int result = this->implementation ()->register_handler (handles,
00292 event_handler,
00293 mask);
00294 if (result == -1)
00295
00296 event_handler->reactor (old_reactor);
00297
00298 return result;
00299 }
00300
00301 ACE_INLINE int
00302 ACE_Reactor::register_handler (int signum,
00303 ACE_Event_Handler *new_sh,
00304 ACE_Sig_Action *new_disp,
00305 ACE_Event_Handler **old_sh,
00306 ACE_Sig_Action *old_disp)
00307 {
00308 return this->implementation ()->register_handler (signum,
00309 new_sh,
00310 new_disp,
00311 old_sh,
00312 old_disp);
00313 }
00314
00315 ACE_INLINE int
00316 ACE_Reactor::register_handler (const ACE_Sig_Set &sigset,
00317 ACE_Event_Handler *new_sh,
00318 ACE_Sig_Action *new_disp)
00319 {
00320 return this->implementation ()->register_handler (sigset,
00321 new_sh,
00322 new_disp);
00323 }
00324
00325 ACE_INLINE int
00326 ACE_Reactor::remove_handler (ACE_Event_Handler *event_handler,
00327 ACE_Reactor_Mask mask)
00328 {
00329 return this->implementation ()->remove_handler (event_handler,
00330 mask);
00331 }
00332
00333 ACE_INLINE int
00334 ACE_Reactor::remove_handler (ACE_HANDLE handle,
00335 ACE_Reactor_Mask mask)
00336 {
00337 return this->implementation ()->remove_handler (handle,
00338 mask);
00339 }
00340
00341 ACE_INLINE int
00342 ACE_Reactor::remove_handler (const ACE_Handle_Set &handle_set,
00343 ACE_Reactor_Mask mask)
00344 {
00345 return this->implementation ()->remove_handler (handle_set,
00346 mask);
00347 }
00348
00349 ACE_INLINE int
00350 ACE_Reactor::remove_handler (int signum,
00351 ACE_Sig_Action *new_disp,
00352 ACE_Sig_Action *old_disp,
00353 int sigkey)
00354 {
00355 return this->implementation ()->remove_handler (signum,
00356 new_disp,
00357 old_disp,
00358 sigkey);
00359 }
00360
00361 ACE_INLINE int
00362 ACE_Reactor::remove_handler (const ACE_Sig_Set &sigset)
00363 {
00364 return this->implementation ()->remove_handler (sigset);
00365 }
00366
00367
00368 ACE_INLINE int
00369 ACE_Reactor::suspend_handler (ACE_Event_Handler *event_handler)
00370 {
00371 return this->implementation ()->suspend_handler (event_handler);
00372 }
00373
00374 ACE_INLINE int
00375 ACE_Reactor::suspend_handler (ACE_HANDLE handle)
00376 {
00377 return this->implementation ()->suspend_handler (handle);
00378 }
00379
00380 ACE_INLINE int
00381 ACE_Reactor::suspend_handler (const ACE_Handle_Set &handles)
00382 {
00383 return this->implementation ()->suspend_handler (handles);
00384 }
00385
00386 ACE_INLINE int
00387 ACE_Reactor::suspend_handlers (void)
00388 {
00389 return this->implementation ()->suspend_handlers ();
00390 }
00391
00392 ACE_INLINE int
00393 ACE_Reactor::resume_handler (ACE_Event_Handler *event_handler)
00394 {
00395 return this->implementation ()->resume_handler (event_handler);
00396 }
00397
00398 ACE_INLINE int
00399 ACE_Reactor::resume_handler (ACE_HANDLE handle)
00400 {
00401 return this->implementation ()->resume_handler (handle);
00402 }
00403
00404 ACE_INLINE int
00405 ACE_Reactor::resume_handler (const ACE_Handle_Set &handles)
00406 {
00407 return this->implementation ()->resume_handler (handles);
00408 }
00409
00410 ACE_INLINE int
00411 ACE_Reactor::resume_handlers (void)
00412 {
00413 return this->implementation ()->resume_handlers ();
00414 }
00415
00416
00417 ACE_INLINE int
00418 ACE_Reactor::reset_timer_interval
00419 (long timer_id,
00420 const ACE_Time_Value &interval)
00421 {
00422 ACE_TRACE ("ACE_Reactor::reset_timer_interval");
00423
00424 return this->implementation ()->reset_timer_interval
00425 (timer_id,
00426 interval);
00427 }
00428
00429 ACE_INLINE long
00430 ACE_Reactor::schedule_timer (ACE_Event_Handler *event_handler,
00431 const void *arg,
00432 const ACE_Time_Value &delta,
00433 const ACE_Time_Value &interval)
00434 {
00435
00436 ACE_Reactor *old_reactor = event_handler->reactor ();
00437
00438
00439 event_handler->reactor (this);
00440
00441 int result = this->implementation ()->schedule_timer (event_handler,
00442 arg,
00443 delta,
00444 interval);
00445 if (result == -1)
00446
00447 event_handler->reactor (old_reactor);
00448
00449 return result;
00450 }
00451
00452 ACE_INLINE int
00453 ACE_Reactor::cancel_timer (ACE_Event_Handler *event_handler,
00454 int dont_call_handle_close)
00455 {
00456 return this->implementation ()->cancel_timer (event_handler,
00457 dont_call_handle_close);
00458 }
00459
00460 ACE_INLINE int
00461 ACE_Reactor::cancel_timer (long timer_id,
00462 const void **arg,
00463 int dont_call_handle_close)
00464 {
00465 return this->implementation ()->cancel_timer (timer_id,
00466 arg,
00467 dont_call_handle_close);
00468 }
00469
00470 ACE_INLINE int
00471 ACE_Reactor::schedule_wakeup (ACE_Event_Handler *event_handler,
00472 ACE_Reactor_Mask masks_to_be_added)
00473 {
00474
00475 ACE_Reactor *old_reactor = event_handler->reactor ();
00476
00477
00478 event_handler->reactor (this);
00479
00480 int result = this->implementation ()->schedule_wakeup (event_handler,
00481 masks_to_be_added);
00482 if (result == -1)
00483
00484 event_handler->reactor (old_reactor);
00485
00486 return result;
00487 }
00488
00489 ACE_INLINE int
00490 ACE_Reactor::schedule_wakeup (ACE_HANDLE handle,
00491 ACE_Reactor_Mask masks_to_be_added)
00492 {
00493 return implementation ()->schedule_wakeup (handle,
00494 masks_to_be_added);
00495 }
00496
00497 ACE_INLINE int
00498 ACE_Reactor::cancel_wakeup (ACE_Event_Handler *event_handler,
00499 ACE_Reactor_Mask masks_to_be_cleared)
00500 {
00501 return this->implementation ()->cancel_wakeup (event_handler,
00502 masks_to_be_cleared);
00503 }
00504
00505 ACE_INLINE int
00506 ACE_Reactor::cancel_wakeup (ACE_HANDLE handle,
00507 ACE_Reactor_Mask masks_to_be_cleared)
00508 {
00509 return this->implementation ()->cancel_wakeup (handle,
00510 masks_to_be_cleared);
00511 }
00512
00513
00514 ACE_INLINE int
00515 ACE_Reactor::notify (ACE_Event_Handler *event_handler,
00516 ACE_Reactor_Mask mask,
00517 ACE_Time_Value *tv)
00518 {
00519
00520
00521 if (event_handler != 0 && event_handler->reactor () == 0)
00522 event_handler->reactor (this);
00523 return this->implementation ()->notify (event_handler,
00524 mask,
00525 tv);
00526 }
00527
00528 ACE_INLINE void
00529 ACE_Reactor::max_notify_iterations (int iterations)
00530 {
00531 this->implementation ()->max_notify_iterations (iterations);
00532 }
00533
00534 ACE_INLINE int
00535 ACE_Reactor::max_notify_iterations (void)
00536 {
00537 return this->implementation ()->max_notify_iterations ();
00538 }
00539
00540 ACE_INLINE int
00541 ACE_Reactor::purge_pending_notifications (ACE_Event_Handler *eh,
00542 ACE_Reactor_Mask mask)
00543 {
00544 return this->implementation ()->purge_pending_notifications (eh, mask);
00545 }
00546
00547 ACE_INLINE int
00548 ACE_Reactor::handler (ACE_HANDLE handle,
00549 ACE_Reactor_Mask mask,
00550 ACE_Event_Handler **event_handler)
00551 {
00552 return this->implementation ()->handler (handle,
00553 mask,
00554 event_handler);
00555 }
00556
00557 ACE_INLINE int
00558 ACE_Reactor::handler (int signum,
00559 ACE_Event_Handler **event_handler)
00560 {
00561 return this->implementation ()->handler (signum,
00562 event_handler);
00563 }
00564
00565 ACE_INLINE int
00566 ACE_Reactor::initialized (void)
00567 {
00568 return this->implementation ()->initialized ();
00569 }
00570
00571 ACE_INLINE ACE_Lock &
00572 ACE_Reactor::lock (void)
00573 {
00574 return this->implementation ()->lock ();
00575 }
00576
00577 ACE_INLINE void
00578 ACE_Reactor::wakeup_all_threads (void)
00579 {
00580 this->implementation ()->wakeup_all_threads ();
00581 }
00582
00583 ACE_INLINE int
00584 ACE_Reactor::owner (ACE_thread_t new_owner,
00585 ACE_thread_t *old_owner)
00586 {
00587 return this->implementation ()->owner (new_owner,
00588 old_owner);
00589 }
00590
00591 ACE_INLINE int
00592 ACE_Reactor::owner (ACE_thread_t *owner)
00593 {
00594 return this->implementation ()->owner (owner);
00595 }
00596
00597 ACE_INLINE int
00598 ACE_Reactor::restart (void)
00599 {
00600 return this->implementation ()->restart ();
00601 }
00602
00603 ACE_INLINE int
00604 ACE_Reactor::restart (int r)
00605 {
00606 return this->implementation ()->restart (r);
00607 }
00608
00609 ACE_INLINE void
00610 ACE_Reactor::requeue_position (int position)
00611 {
00612 this->implementation ()->requeue_position (position);
00613 }
00614
00615 ACE_INLINE int
00616 ACE_Reactor::requeue_position (void)
00617 {
00618 return this->implementation ()->requeue_position ();
00619 }
00620
00621
00622 ACE_INLINE int
00623 ACE_Reactor::mask_ops (ACE_Event_Handler *event_handler,
00624 ACE_Reactor_Mask mask,
00625 int ops)
00626 {
00627 return this->implementation ()->mask_ops (event_handler,
00628 mask,
00629 ops);
00630 }
00631
00632 ACE_INLINE int
00633 ACE_Reactor::mask_ops (ACE_HANDLE handle,
00634 ACE_Reactor_Mask mask,
00635 int ops)
00636 {
00637 return this->implementation ()->mask_ops (handle,
00638 mask,
00639 ops);
00640 }
00641
00642 ACE_INLINE int
00643 ACE_Reactor::ready_ops (ACE_Event_Handler *event_handler,
00644 ACE_Reactor_Mask mask,
00645 int ops)
00646 {
00647 return this->implementation ()->ready_ops (event_handler,
00648 mask,
00649 ops);
00650 }
00651
00652 ACE_INLINE int
00653 ACE_Reactor::ready_ops (ACE_HANDLE handle,
00654 ACE_Reactor_Mask mask,
00655 int ops)
00656 {
00657 return this->implementation ()->ready_ops (handle,
00658 mask,
00659 ops);
00660 }
00661
00662 ACE_INLINE size_t
00663 ACE_Reactor::size (void) const
00664 {
00665 return this->implementation ()->size ();
00666 }
00667
00668 ACE_INLINE int
00669 ACE_Reactor::uses_event_associations (void)
00670 {
00671 return this->implementation ()->uses_event_associations ();
00672 }
00673
00674
00675