Restore build on FreeBSD.
[getmangos.git] / dep / ACE_wrappers / ace / TP_Reactor.inl
blob2b14a8c9b963ae6fe86ecb9ca521499b812d0099
1 // -*- C++ -*-
2 //
3 // $Id: TP_Reactor.inl 80826 2008-03-04 14:51:23Z wotte $
5 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
7 /************************************************************************/
8 // Methods for ACE_EH_Dispatch_Info
9 /************************************************************************/
11 ACE_INLINE
12 ACE_EH_Dispatch_Info::ACE_EH_Dispatch_Info (void) :
13   handle_ (ACE_INVALID_HANDLE),
14   event_handler_ (0),
15   mask_ (ACE_Event_Handler::NULL_MASK),
16   callback_ (0),
17   resume_flag_ (ACE_Event_Handler::ACE_REACTOR_RESUMES_HANDLER),
18   reference_counting_required_ (false),
19   dispatch_ (false)
23 ACE_INLINE void
24 ACE_EH_Dispatch_Info::set (ACE_HANDLE handle,
25                            ACE_Event_Handler *event_handler,
26                            ACE_Reactor_Mask mask,
27                            ACE_EH_PTMF callback)
29   this->dispatch_ = true;
31   this->handle_ = handle;
32   this->event_handler_ = event_handler;
33   this->mask_ = mask;
34   this->callback_ = callback;
35   if (event_handler_)
36     {
37       this->resume_flag_ = event_handler->resume_handler ();
38       this->reference_counting_required_ =
39         (event_handler_->reference_counting_policy ().value () ==
40          ACE_Event_Handler::Reference_Counting_Policy::ENABLED);
41     }
42   else
43     this->dispatch_ = false;
46 ACE_INLINE bool
47 ACE_EH_Dispatch_Info::dispatch (void) const
49   return this->dispatch_;
52 /************************************************************************/
53 // Methods for ACE_TP_Token_Guard
54 /************************************************************************/
56 ACE_INLINE
57 ACE_TP_Token_Guard::ACE_TP_Token_Guard (ACE_Select_Reactor_Token &token)
59   : token_ (token),
60     owner_ (false)
64 ACE_INLINE
65 ACE_TP_Token_Guard::~ACE_TP_Token_Guard (void)
67   if (this->owner_)
68     {
69       ACE_MT (this->token_.release ());
70       this->owner_ = false;
71     }
74 ACE_INLINE void
75 ACE_TP_Token_Guard::release_token (void)
77   if (this->owner_)
78     {
79       ACE_MT (this->token_.release ());
81       // We are not the owner anymore..
82       this->owner_ = false;
83     }
86 ACE_INLINE bool
87 ACE_TP_Token_Guard::is_owner (void)
89   return this->owner_;
93 /************************************************************************/
94 // Methods for ACE_TP_Reactor
95 /************************************************************************/
97 ACE_INLINE void
98 ACE_TP_Reactor::no_op_sleep_hook (void *)
102 ACE_INLINE void
103 ACE_TP_Reactor::clear_handle_read_set (ACE_HANDLE handle)
105   this->ready_set_.wr_mask_.clr_bit (handle);
106   this->ready_set_.ex_mask_.clr_bit (handle);
107   this->ready_set_.rd_mask_.clr_bit (handle);
110 ACE_INLINE void
111 ACE_TP_Reactor::clear_dispatch_mask (ACE_HANDLE ,
112                                      ACE_Reactor_Mask )
114   this->ready_set_.rd_mask_.reset ();
115   this->ready_set_.wr_mask_.reset ();
116   this->ready_set_.ex_mask_.reset ();
119 ACE_END_VERSIONED_NAMESPACE_DECL