Fixed typos
[ACE_TAO.git] / ACE / ace / Dev_Poll_Reactor.inl
blob2b69631f2c2ee38307064fd01335c0e5edf6da56
1 // -*- C++ -*-
2 #include "ace/Log_Category.h"
4 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
6 ACE_INLINE
7 ACE_Dev_Poll_Reactor::Event_Tuple::Event_Tuple (ACE_Event_Handler *eh,
8                                                 ACE_Reactor_Mask m,
9                                                 bool is_suspended,
10                                                 bool is_controlled)
11   : event_handler (eh),
12     mask (m),
13     suspended (is_suspended),
14     controlled (is_controlled)
18 // ---------------------------------------------------------------------
20 ACE_INLINE size_t
21 ACE_Dev_Poll_Reactor::Handler_Repository::size (void) const
23   ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::size");
25   return this->size_;
28 ACE_INLINE size_t
29 ACE_Dev_Poll_Reactor::Handler_Repository::max_size (void) const
31   ACE_TRACE ("ACE_Dev_Poll_Reactor::Handler_Repository::max_size");
33   return this->max_size_;
36 // -----------------------------------------------------------------
38 ACE_INLINE
39 ACE_Dev_Poll_Handler_Guard::ACE_Dev_Poll_Handler_Guard
40   (ACE_Event_Handler *eh,
41    bool do_incr)
42   : eh_ (eh),
43     refcounted_ (false)
45   if (eh == 0)
46     return;
48   this->refcounted_ =
49     eh->reference_counting_policy ().value () ==
50     ACE_Event_Handler::Reference_Counting_Policy::ENABLED;
52   if (do_incr && this->refcounted_)
53     eh->add_reference ();
56 ACE_INLINE
57 ACE_Dev_Poll_Handler_Guard::~ACE_Dev_Poll_Handler_Guard (void)
59   if (this->refcounted_ && this->eh_ != 0)
60     this->eh_->remove_reference ();
63 ACE_INLINE void
64 ACE_Dev_Poll_Handler_Guard::release (void)
66   this->eh_ = 0;
69 // ---------------------------------------------------------------------
71 ACE_INLINE int
72 ACE_Dev_Poll_Reactor::upcall (ACE_Event_Handler *event_handler,
73                               int (ACE_Event_Handler::*callback)(ACE_HANDLE),
74                               ACE_HANDLE handle)
76   // If the handler returns positive value (requesting a reactor
77   // callback) just call back as many times as the handler requests
78   // it.  The handler is suspended internally and other threads are off
79   // handling other things.
80   int status = 0;
82   do
83     {
84       status = (event_handler->*callback) (handle);
85     }
86   while (status > 0 && event_handler != this->notify_handler_);
88   return status;
92 /************************************************************************/
93 // Methods for ACE_Dev_Poll_Reactor::Token_Guard
94 /************************************************************************/
96 ACE_INLINE
97 ACE_Dev_Poll_Reactor::Token_Guard::Token_Guard (ACE_Dev_Poll_Reactor_Token &token)
99   : token_ (token),
100     owner_ (false)
104 ACE_INLINE
105 ACE_Dev_Poll_Reactor::Token_Guard::~Token_Guard (void)
107   if (this->owner_)
108     {
109       ACE_MT (this->token_.release ());
110       this->owner_ = false;
111     }
114 ACE_INLINE void
115 ACE_Dev_Poll_Reactor::Token_Guard::release_token (void)
117   if (this->owner_)
118     {
119       ACE_MT (this->token_.release ());
121       // We are not the owner anymore..
122       this->owner_ = false;
123     }
126 ACE_INLINE bool
127 ACE_Dev_Poll_Reactor::Token_Guard::is_owner (void)
129   return this->owner_;
132 ACE_END_VERSIONED_NAMESPACE_DECL