1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
|
/* -*- C++ -*- */
// $Id$
#include "ace/Reactor.h"
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::resume_handler (ACE_Event_Handler *h)
{
ACE_TRACE ("ACE_Select_Reactor_T::resume_handler");
return this->resume_handler (h->get_handle ());
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::resume_handler (const ACE_Handle_Set &handles)
{
ACE_TRACE ("ACE_Select_Reactor_T::resume_handler");
ACE_Handle_Set_Iterator handle_iter (handles);
ACE_HANDLE h;
ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
if (this->resume_i (h) == -1)
return -1;
return 0;
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::suspend_handler (ACE_Event_Handler *h)
{
ACE_TRACE ("ACE_Select_Reactor_T::suspend_handler");
return this->suspend_handler (h->get_handle ());
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::suspend_handler (const ACE_Handle_Set &handles)
{
ACE_TRACE ("ACE_Select_Reactor_T::suspend_handler");
ACE_Handle_Set_Iterator handle_iter (handles);
ACE_HANDLE h;
ACE_MT (ACE_GUARD_RETURN (ACE_SELECT_REACTOR_TOKEN, ace_mon, this->token_, -1));
while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
if (this->suspend_i (h) == -1)
return -1;
return 0;
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (int signum,
ACE_Event_Handler *new_sh,
ACE_Sig_Action *new_disp,
ACE_Event_Handler **old_sh,
ACE_Sig_Action *old_disp)
{
ACE_TRACE ("ACE_Select_Reactor_T::register_handler");
return this->signal_handler_->register_handler (signum,
new_sh, new_disp,
old_sh, old_disp);
}
#if defined (ACE_WIN32)
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (ACE_Event_Handler *event_handler,
ACE_HANDLE event_handle)
{
// Don't have an implementation for this yet...
ACE_UNUSED_ARG (event_handler);
ACE_UNUSED_ARG (event_handle);
ACE_NOTSUP_RETURN (-1);
}
#endif /* ACE_WIN32 */
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::register_handler (ACE_HANDLE event_handle,
ACE_HANDLE io_handle,
ACE_Event_Handler *event_handler,
ACE_Reactor_Mask mask)
{
// Don't have an implementation for this yet...
ACE_UNUSED_ARG (event_handle);
ACE_UNUSED_ARG (io_handle);
ACE_UNUSED_ARG (event_handler);
ACE_UNUSED_ARG (mask);
ACE_NOTSUP_RETURN (-1);
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::handler (int signum, ACE_Event_Handler **handler)
{
ACE_TRACE ("ACE_Select_Reactor_T::handler");
return this->handler_i (signum, handler);
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::remove_handler (int signum,
ACE_Sig_Action *new_disp,
ACE_Sig_Action *old_disp,
int sigkey)
{
ACE_TRACE ("ACE_Select_Reactor_T::remove_handler");
return this->signal_handler_->remove_handler (signum, new_disp, old_disp, sigkey);
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::uses_event_associations (void)
{
// Since the Select_Reactor does not do any event associations, this
// function always return 0.
return 0;
}
// = The remaining methods in this file must be called with locks
// held. Note the queue handles its own locking.
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::cancel_timer (ACE_Event_Handler *handler,
int dont_call_handle_close)
{
ACE_TRACE ("ACE_Select_Reactor_T::cancel_timer");
return this->timer_queue_ != 0 &&
this->timer_queue_->cancel (handler, dont_call_handle_close);
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::cancel_timer (long timer_id,
const void **arg,
int dont_call_handle_close)
{
ACE_TRACE ("ACE_Select_Reactor_T::cancel_timer");
return this->timer_queue_->cancel (timer_id,
arg,
dont_call_handle_close);
}
// Performs operations on the "ready" bits.
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::ready_ops (ACE_Event_Handler *handler,
ACE_Reactor_Mask mask,
int ops)
{
ACE_TRACE ("ACE_Select_Reactor_T::ready_ops");
return this->ready_ops (handler->get_handle (), mask, ops);
}
// Performs operations on the "dispatch" masks.
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::mask_ops (ACE_Event_Handler *handler,
ACE_Reactor_Mask mask,
int ops)
{
ACE_TRACE ("ACE_Select_Reactor_T::mask_ops");
return this->mask_ops (handler->get_handle (), mask, ops);
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::schedule_wakeup (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Select_Reactor_T::schedule_wakeup");
return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::ADD_MASK);
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::cancel_wakeup (ACE_Event_Handler *eh,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Select_Reactor_T::cancel_wakeup");
return this->mask_ops (eh->get_handle (), mask, ACE_Reactor::CLR_MASK);
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::schedule_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Select_Reactor_T::schedule_wakeup");
return this->mask_ops (handle, mask, ACE_Reactor::ADD_MASK);
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::cancel_wakeup (ACE_HANDLE handle,
ACE_Reactor_Mask mask)
{
ACE_TRACE ("ACE_Select_Reactor_T::cancel_wakeup");
return this->mask_ops (handle, mask, ACE_Reactor::CLR_MASK);
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ ACE_Lock &
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::lock (void)
{
ACE_TRACE ("ACE_Select_Reactor_T::lock");
return this->lock_adapter_;
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ void
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::wakeup_all_threads (void)
{
// Send a notification, but don't block if there's no one to receive
// it.
this->notify (0, ACE_Event_Handler::NULL_MASK, (ACE_Time_Value *) &ACE_Time_Value::zero);
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::alertable_handle_events (ACE_Time_Value *max_wait_time)
{
return this->handle_events (max_wait_time);
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::alertable_handle_events (ACE_Time_Value &max_wait_time)
{
return this->handle_events (max_wait_time);
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ int
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::deactivated (void)
{
return this->deactivated_;
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ void
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::deactivate (int do_stop)
{
this->deactivated_ = do_stop;
this->wakeup_all_threads ();
}
template <class ACE_SELECT_REACTOR_TOKEN> /* ACE_INLINE */ size_t
ACE_Select_Reactor_T<ACE_SELECT_REACTOR_TOKEN>::size (void)
{
return this->handler_rep_.size ();
}
|