7 #if defined (ACE_HAS_EVENT_POLL) || defined (ACE_HAS_DEV_POLL) 13 # if defined (ACE_HAS_DEV_POLL) 14 # if defined (ACE_LINUX) 15 # include <linux/devpoll.h>
16 # elif defined (HPUX_VERS) && HPUX_VERS < 1123 19 # include <sys/devpoll.h>
23 #if !defined (__ACE_INLINE__) 51 , notification_pipe_ ()
52 , max_notify_iterations_ (-1)
53 #if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) 54 , notification_queue_ ()
62 int disable_notify_pipe)
64 ACE_TRACE (
"ACE_Dev_Poll_Reactor_Notify::open");
66 if (disable_notify_pipe == 0)
70 if (this->dp_reactor_ == 0)
76 if (this->notification_pipe_.open () == -1)
79 #if defined (F_SETFD) && !defined (ACE_LACKS_FCNTL) 81 if (
ACE_OS::fcntl (this->notification_pipe_.read_handle (), F_SETFD, 1) == -1)
85 if (
ACE_OS::fcntl (this->notification_pipe_.write_handle (), F_SETFD, 1) == -1)
91 #if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) 92 if (notification_queue_.open () == -1)
116 ACE_TRACE (
"ACE_Dev_Poll_Reactor_Notify::close");
118 #if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) 119 notification_queue_.reset ();
122 return this->notification_pipe_.close ();
130 ACE_TRACE (
"ACE_Dev_Poll_Reactor_Notify::notify");
134 if (this->dp_reactor_ == 0)
139 #if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) 140 ACE_UNUSED_ARG (timeout);
146 if (-1 == this->notification_queue_.push_new_notification (buffer))
161 if (n == -1 && (errno != EAGAIN))
187 ACE_TRACE (
"ACE_Dev_Poll_Reactor_Notify::dispatch_notifications");
204 ACE_TRACE (
"ACE_Dev_Poll_Reactor_Notify::read_notify_pipe");
216 #if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) 227 (void)
ACE::recv (handle, read_p, to_read);
229 bool more_messages_queued =
false;
234 result = notification_queue_.pop_next_notification (buffer,
235 more_messages_queued,
249 if (more_messages_queued)
250 (void)
ACE::send (this->notification_pipe_.write_handle (),
255 to_read =
sizeof buffer;
256 read_p = (
char *)&buffer;
263 if (static_cast<size_t> (n) != to_read)
265 size_t remainder = to_read - n;
271 if (
ACE::recv (handle, &read_p[n], remainder) <= 0)
279 if (n <= 0 && (errno !=
EWOULDBLOCK && errno != EAGAIN))
290 ACE_TRACE (
"ACE_Dev_Poll_Reactor_Notify::handle_input");
297 ACE_TRACE (
"ACE_Dev_Poll_Reactor_Notify::notify_handle");
299 return this->notification_pipe_.read_handle ();
305 ACE_TRACE (
"ACE_Dev_Poll_Reactor_Notify::is_dispatchable");
313 ACE_TRACE (
"ACE_Dev_Poll_Reactor_Notify::dispatch_notify");
329 switch (buffer.
mask_)
344 ACE_TEXT (
"dispatch_notify invalid mask = %d\n"),
357 ACE_TRACE (
"ACE_Dev_Poll_Reactor_Notify::max_notify_iterations");
369 ACE_TRACE (
"ACE_Dev_Poll_Reactor_Notify::max_notify_iterations");
379 ACE_TRACE (
"ACE_Dev_Poll_Reactor_Notify::purge_pending_notifications");
381 #if defined (ACE_HAS_REACTOR_NOTIFICATION_QUEUE) 383 return notification_queue_.purge_pending_notifications (eh, mask);
387 ACE_UNUSED_ARG (mask);
395 #if defined (ACE_HAS_DUMP) 396 ACE_TRACE (
"ACE_Dev_Poll_Reactor_Notify::dump");
402 this->notification_pipe_.dump ();
423 ACE_TRACE (
"ACE_Dev_Poll_Reactor::Handler_Repository::Handler_Repository");
428 ACE_HANDLE handle)
const 430 ACE_TRACE (
"ACE_Dev_Poll_Reactor::Handler_Repository::invalid_handle");
432 if (handle < 0 || handle >= this->
max_size_)
443 ACE_HANDLE handle)
const 445 ACE_TRACE (
"ACE_Dev_Poll_Reactor::Handler_Repository::handle_in_range");
447 if (handle >= 0 && handle < this->
max_size_)
459 ACE_TRACE (
"ACE_Dev_Poll_Reactor::Handler_Repository::open");
474 ACE_TRACE (
"ACE_Dev_Poll_Reactor::Handler_Repository::unbind_all");
486 bool const requires_reference_counting =
491 this->
unbind (handle, requires_reference_counting);
500 ACE_TRACE (
"ACE_Dev_Poll_Reactor::Handler_Repository::close");
516 ACE_TRACE (
"ACE_Dev_Poll_Reactor::Handler_Repository::find");
543 ACE_TRACE (
"ACE_Dev_Poll_Reactor::Handler_Repository::bind");
545 if (event_handler == 0)
548 if (handle == ACE_INVALID_HANDLE)
566 ACE_TRACE (
"ACE_Dev_Poll_Reactor::Handler_Repository::unbind");
587 int disable_notify_pipe,
594 #if defined (ACE_HAS_DEV_POLL)
611 ACE_TRACE (
"ACE_Dev_Poll_Reactor::ACE_Dev_Poll_Reactor");
621 ACE_TEXT (
"ACE_Dev_Poll_Reactor::open ")
623 ACE_TEXT (
"ACE_Dev_Poll_Reactor::CTOR")));
630 int disable_notify_pipe,
637 #if defined (ACE_HAS_DEV_POLL)
654 if (this->
open (size,
662 ACE_TEXT (
"ACE_Dev_Poll_Reactor::open ")
663 ACE_TEXT (
"failed inside ACE_Dev_Poll_Reactor::CTOR")));
668 ACE_TRACE (
"ACE_Dev_Poll_Reactor::~ACE_Dev_Poll_Reactor");
670 (void) this->
close ();
678 int disable_notify_pipe,
681 ACE_TRACE (
"ACE_Dev_Poll_Reactor::open");
689 #ifdef ACE_HAS_EVENT_POLL 691 this->event_.data.fd = ACE_INVALID_HANDLE;
740 #if defined (ACE_HAS_EVENT_POLL) 743 this->
poll_fd_ = ::epoll_create (size);
757 if (this->
poll_fd_ == ACE_INVALID_HANDLE)
769 disable_notify_pipe) == -1
770 || (disable_notify_pipe == 0
782 (void) this->
close ();
829 ACE_TRACE (
"ACE_Dev_Poll_Reactor::close");
835 if (this->
poll_fd_ != ACE_INVALID_HANDLE)
840 #if defined (ACE_HAS_EVENT_POLL) 843 this->event_.data.fd = ACE_INVALID_HANDLE;
885 this->
poll_fd_ = ACE_INVALID_HANDLE;
895 ACE_TRACE (
"ACE_Dev_Poll_Reactor::work_pending");
912 ACE_MT (countdown.update ());
920 ACE_TRACE (
"ACE_Dev_Poll_Reactor::work_pending_i");
925 #if defined (ACE_HAS_EVENT_POLL) 926 if (this->event_.data.fd != ACE_INVALID_HANDLE)
938 int const timers_pending =
939 ((this_timeout != 0 && max_wait_time == 0)
940 || (this_timeout != 0 && max_wait_time != 0
941 && *this_timeout != *max_wait_time) ? 1 : 0);
946 :
static_cast<long> (this_timeout->
msec ()));
948 #if defined (ACE_HAS_EVENT_POLL) 951 int const nfds = ::epoll_wait (this->
poll_fd_,
954 static_cast<int> (timeout));
962 dvp.dp_timeout = timeout;
978 return (nfds == 0 && timers_pending != 0 ? 1 : nfds);
985 ACE_TRACE (
"ACE_Dev_Poll_Reactor::handle_events");
1007 ACE_MT (countdown.update ());
1016 ACE_TRACE (
"ACE_Dev_Poll_Reactor::handle_events_i");
1028 if (result == -1 && (this->
restart_ == 0 || errno != EINTR))
1031 while (result == -1 && this->
restart_ != 0 && errno == EINTR);
1033 if (result == 0 || (result == -1 && errno ==
ETIME))
1035 else if (result == -1)
1061 ACE_TRACE (
"ACE_Dev_Poll_Reactor::dispatch");
1092 ACE_Dev_Poll_Reactor::dispatch_notification_handlers (
1094 int &number_of_active_handles,
1095 int &number_of_handlers_dispatched)
1111 number_of_handlers_dispatched += n;
1124 #if defined (ACE_HAS_EVENT_POLL) 1125 const __uint32_t out_event = EPOLLOUT;
1126 const __uint32_t exc_event = EPOLLPRI;
1127 const __uint32_t in_event = EPOLLIN;
1128 const __uint32_t err_event = EPOLLHUP | EPOLLERR;
1130 const short out_event = POLLOUT;
1131 const short exc_event = POLLPRI;
1132 const short in_event = POLLIN;
1133 const short err_event = 0;
1136 #if defined (ACE_HAS_EVENT_POLL) 1140 const ACE_HANDLE handle = this->event_.data.fd;
1141 __uint32_t revents = this->event_.events;
1142 this->event_.data.fd = ACE_INVALID_HANDLE;
1143 this->event_.events = 0;
1144 if (handle != ACE_INVALID_HANDLE)
1163 const ACE_HANDLE handle = pfds->fd;
1164 short &revents = pfds->revents;
1182 bool reactor_resumes_eh =
false;
1227 #ifdef ACE_HAS_DEV_POLL 1235 ACE_TEXT (
"(%t) dispatch_io h %d unknown events 0x%x\n"),
1239 #ifdef ACE_HAS_DEV_POLL 1258 reactor_resumes_eh =
1299 status = this->
upcall (eh, callback, handle);
1308 #ifdef ACE_HAS_EVENT_POLL 1312 if (reactor_resumes_eh)
1335 #ifdef ACE_HAS_EVENT_POLL 1339 if (reactor_resumes_eh)
1362 ACE_TRACE (
"ACE_Dev_Poll_Reactor::alertable_handle_events");
1370 ACE_TRACE (
"ACE_Dev_Poll_Reactor::handle_events");
1378 ACE_TRACE (
"ACE_Dev_Poll_Reactor::alertable_handle_events");
1400 ACE_TRACE (
"ACE_Dev_Poll_Reactor::register_handler");
1414 ACE_TRACE (
"ACE_Dev_Poll_Reactor::register_handler");
1428 ACE_TRACE (
"ACE_Dev_Poll_Reactor::register_handler_i");
1430 if (handle == ACE_INVALID_HANDLE
1443 #if defined (ACE_HAS_EVENT_POLL) 1447 struct epoll_event epev;
1449 static const int op = EPOLL_CTL_ADD;
1451 epev.data.fd = handle;
1457 epev.events |= EPOLLONESHOT;
1459 if (::epoll_ctl (this->
poll_fd_, op, handle, &epev) == -1)
1479 #ifdef ACE_HAS_DEV_POLL 1518 ACE_TRACE (
"ACE_Dev_Poll_Reactor::register_handler");
1529 for (ACE_HANDLE h = handle_iter ();
1530 h != ACE_INVALID_HANDLE;
1545 ACE_TRACE (
"ACE_Dev_Poll_Reactor::register_handler");
1559 ACE_TRACE (
"ACE_Dev_Poll_Reactor::register_handler");
1574 ACE_UNUSED_ARG (sigset);
1575 ACE_UNUSED_ARG (new_sh);
1576 ACE_UNUSED_ARG (new_disp);
1587 ACE_TRACE (
"ACE_Dev_Poll_Reactor::remove_handler");
1597 ACE_TRACE (
"ACE_Dev_Poll_Reactor::remove_handler");
1612 ACE_TRACE (
"ACE_Dev_Poll_Reactor::remove_handler_i");
1616 bool handle_reg_changed =
true;
1618 if (info == 0 && eh == 0)
1624 handle_reg_changed =
false;
1629 bool const requires_reference_counting =
1653 ACE_TRACE (
"ACE_Dev_Poll_Reactor::remove_handler");
1656 for (ACE_HANDLE h = handle_iter ();
1657 h != ACE_INVALID_HANDLE;
1673 ACE_TRACE (
"ACE_Dev_Poll_Reactor::remove_handler");
1684 ACE_TRACE (
"ACE_Dev_Poll_Reactor::remove_handler");
1697 ACE_UNUSED_ARG (sigset);
1707 ACE_TRACE (
"ACE_Dev_Poll_Reactor::suspend_handler");
1709 if (event_handler == 0)
1715 ACE_HANDLE handle = event_handler->
get_handle ();
1725 ACE_TRACE (
"ACE_Dev_Poll_Reactor::suspend_handler");
1735 ACE_TRACE (
"ACE_Dev_Poll_Reactor::suspend_handler");
1742 while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
1752 ACE_TRACE (
"ACE_Dev_Poll_Reactor::suspend_handlers");
1758 for (
size_t i = 0; i < len; ++i)
1761 if (info != 0 && !info->
suspended && this->suspend_handler_i (i) != 0)
1770 ACE_TRACE (
"ACE_Dev_Poll_Reactor::suspend_handler_i");
1785 #if defined (ACE_HAS_EVENT_POLL) 1787 struct epoll_event epev;
1789 static const int op = EPOLL_CTL_DEL;
1792 epev.data.fd = handle;
1794 if (::epoll_ctl (this->
poll_fd_, op, handle, &epev) == -1)
1799 struct pollfd pfd[1];
1802 pfd[0].events = POLLREMOVE;
1818 ACE_TRACE (
"ACE_Dev_Poll_Reactor::resume_handler");
1820 if (event_handler == 0)
1826 ACE_HANDLE handle = event_handler->
get_handle ();
1836 ACE_TRACE (
"ACE_Dev_Poll_Reactor::resume_handler");
1846 ACE_TRACE (
"ACE_Dev_Poll_Reactor::resume_handler");
1853 while ((h = handle_iter ()) != ACE_INVALID_HANDLE)
1863 ACE_TRACE (
"ACE_Dev_Poll_Reactor::resume_handlers");
1869 for (
size_t i = 0; i < len; ++i)
1872 if (info != 0 && info->
suspended && this->resume_handler_i (i) != 0)
1882 ACE_TRACE (
"ACE_Dev_Poll_Reactor::resume_handler_i");
1902 #if defined (ACE_HAS_EVENT_POLL) 1904 struct epoll_event epev;
1906 int op = EPOLL_CTL_ADD;
1910 epev.data.fd = handle;
1912 if (::epoll_ctl (this->
poll_fd_, op, handle, &epev) == -1)
1918 struct pollfd pfd[1];
1956 ACE_TRACE (
"ACE_Dev_Poll_Reactor::schedule_timer");
1975 ACE_TRACE (
"ACE_Dev_Poll_Reactor::reset_timer_interval");
1988 int dont_call_handle_close)
1990 ACE_TRACE (
"ACE_Dev_Poll_Reactor::cancel_timer");
2003 int dont_call_handle_close)
2005 ACE_TRACE (
"ACE_Dev_Poll_Reactor::cancel_timer");
2013 dont_call_handle_close));
2020 ACE_TRACE (
"ACE_Dev_Poll_Reactor::schedule_wakeup");
2029 ACE_TRACE (
"ACE_Dev_Poll_Reactor::schedule_wakeup");
2038 ACE_TRACE (
"ACE_Dev_Poll_Reactor::cancel_wakeup");
2047 ACE_TRACE (
"ACE_Dev_Poll_Reactor::cancel_wakeup");
2057 ACE_TRACE (
"ACE_Dev_Poll_Reactor::notify");
2067 return n == -1 ? -1 : 0;
2073 ACE_TRACE (
"ACE_Dev_Poll_Reactor::max_notify_iterations");
2083 ACE_TRACE (
"ACE_Dev_Poll_Reactor::max_notify_iterations");
2122 ACE_TRACE (
"ACE_Dev_Poll_Reactor::handler");
2133 if (event_handler != 0)
2146 ACE_TRACE (
"ACE_Dev_Poll_Reactor::handler");
2161 ACE_TRACE (
"ACE_Dev_Poll_Reactor::initialized");
2177 ACE_TRACE (
"ACE_Dev_Poll_Reactor::lock");
2185 ACE_TRACE (
"ACE_Dev_Poll_Reactor::wakeup_all_threads");
2198 ACE_TRACE (
"ACE_Dev_Poll_Reactor::owner");
2209 ACE_TRACE (
"ACE_Dev_Poll_Reactor::owner");
2220 ACE_TRACE (
"ACE_Dev_Poll_Reactor::restart");
2230 ACE_TRACE (
"ACE_Dev_Poll_Reactor::restart");
2234 bool current_value = this->
restart_;
2236 return current_value;
2242 ACE_TRACE (
"ACE_Dev_Poll_Reactor::requeue_position");
2248 ACE_TRACE (
"ACE_Dev_Poll_Reactor::requeue_position");
2258 ACE_TRACE (
"ACE_Dev_Poll_Reactor::mask_ops");
2270 ACE_TRACE (
"ACE_Dev_Poll_Reactor::mask_ops");
2282 ACE_TRACE (
"ACE_Dev_Poll_Reactor::mask_ops_i");
2330 info->
mask = new_mask;
2345 struct pollfd pfd[2];
2348 pfd[0].events = POLLREMOVE;
2350 pfd[1].fd = (events == POLLREMOVE ? ACE_INVALID_HANDLE : handle);
2351 pfd[1].events = events;
2357 sizeof (pfd)) !=
sizeof (pfd))
2359 #elif defined (ACE_HAS_EVENT_POLL) 2361 struct epoll_event epev;
2374 epev.events = events | EPOLLONESHOT;
2377 epev.data.fd = handle;
2379 if (::epoll_ctl (this->
poll_fd_, op, handle, &epev) == -1)
2385 if (op != EPOLL_CTL_MOD || errno != ENOENT ||
2386 ::epoll_ctl (this->
poll_fd_, EPOLL_CTL_ADD, handle, &epev) == -1)
2394 pfd[0].events = events;
2400 sizeof (pfd)) !=
sizeof (pfd))
2413 ACE_TRACE (
"ACE_Dev_Poll_Reactor::ready_ops");
2426 ACE_TRACE (
"ACE_Dev_Poll_Reactor::ready_ops");
2437 #if defined (ACE_HAS_DUMP) 2438 ACE_TRACE (
"ACE_Dev_Poll_Reactor::dump");
2457 ACE_TRACE (
"ACE_Dev_Poll_Reactor::reactor_mask_to_poll_event");
2461 #if defined (ACE_HAS_EVENT_POLL) 2462 return EPOLL_CTL_DEL;
2475 #if defined (ACE_HAS_EVENT_POLL) 2486 #if defined (ACE_HAS_EVENT_POLL) 2496 #if defined (ACE_HAS_EVENT_POLL) 2506 #if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0) 2508 void polite_sleep_hook (
void *) { }
2515 ACE_TRACE (
"ACE_Dev_Poll_Reactor::Token_Guard::acquire_quietly");
2546 this->owner_ =
true;
2554 ACE_TRACE (
"ACE_Dev_Poll_Reactor::Token_Guard::acquire");
2581 this->owner_ =
true;
virtual int handle_input(ACE_HANDLE handle)
virtual bool initialized(void)
virtual int register_handler(ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask)
Provides an abstract interface for handling various types of I/O, timer, and signal events...
A `/dev/poll' or `/dev/epoll' based Reactor implemenatation.
#define ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#define ACE_GUARD(MUTEX, OBJ, LOCK)
int acquire_quietly(ACE_Time_Value *max_wait=0)
int is_member(int signo) const
Checks whether the signal specified by signo is in the set.
virtual ~ACE_Dev_Poll_Reactor(void)
Close down and release all resources.
ACE_Handle_Set rd_mask_
Read events (e.g., input pending, accept pending).
virtual int notify(ACE_Event_Handler *eh=0, ACE_Reactor_Mask mask=ACE_Event_Handler::EXCEPT_MASK, ACE_Time_Value *timeout=0)
virtual int resumable_handler(void)
Reference_Counting_Policy & reference_counting_policy(void)
Current Reference_Counting_Policy.
int fcntl(ACE_HANDLE handle, int cmd, long arg=0)
virtual ACE_Timer_Queue * timer_queue(void) const
virtual int notify(ACE_Event_Handler *event_handler=0, ACE_Reactor_Mask mask=ACE_Event_Handler::EXCEPT_MASK, ACE_Time_Value *=0)
int unbind(ACE_HANDLE handle, bool decr_refcnt=true)
ACE_Reactor_Notify * notify_handler_
int resume_handler_i(ACE_HANDLE handle)
virtual int dispatch_notify(ACE_Notification_Buffer &buffer)=0
unsigned long ACE_Reactor_Mask
This data structure is meant to be used within a method or function... It performs automatic acquisit...
ACE_Sig_Handler * signal_handler_
Handle signals without requiring global/static variables.
virtual int handle_input(ACE_HANDLE fd=ACE_INVALID_HANDLE)
Called when input events occur (e.g., connection or data).
Event handler used for unblocking the ACE_Dev_Poll_Reactor from its event loop.
virtual int handle_output(ACE_HANDLE fd=ACE_INVALID_HANDLE)
C++ wrapper facade for the sigaction struct.
virtual int close(void)=0
Operations on "timeval" structures, which express time in seconds (secs) and microseconds (usecs)...
virtual ACE_HANDLE notify_handle(void)=0
This is the main dispatcher of signals for ACE. It improves the existing UNIX signal handling mechani...
virtual int cancel_wakeup(ACE_Event_Handler *event_handler, ACE_Reactor_Mask masks_to_be_cleared)
Clear masks_to_be_cleared from the event_handler's entry.
virtual int purge_pending_notifications(ACE_Event_Handler *=0, ACE_Reactor_Mask=ACE_Event_Handler::ALL_EVENTS_MASK)
virtual int max_notify_iterations(void)
virtual void dump(void) const
Dump the state of an object.
Base class for all timer queues of a single type.
virtual int resume_handlers(void)
Resume all handles.
bool delete_notify_handler_
int unbind_all(void)
Remove all the registered tuples.
Keeps track of the amount of elapsed time.
virtual void deactivate(int do_stop)
ssize_t recv(ACE_HANDLE handle, void *buf, size_t len, int flags, const ACE_Time_Value *timeout=0)
Receive into a variable number of pieces.
virtual ACE_HANDLE notify_handle(void)
virtual int suspend_handlers(void)
Suspend all handles temporarily.
virtual ACE_Time_Value gettimeofday(void)=0
int acquire(void)
Return 0.
Iterator for the ACE_Handle_Set abstraction.
virtual int current_info(ACE_HANDLE handle, size_t &)
An abstract class for implementing the Reactor Pattern.
int acquire(void)
Explicitly acquire the lock.
Simple wrapper for passing ACE_Event_Handler *s and ACE_Reactor_Masks between threads.
ssize_t send(ACE_HANDLE handle, const void *buf, size_t len, int flags, const ACE_Time_Value *timeout=0)
Receive into a variable number of pieces.
Class used to make event handler reference count manipulation exception-safe.
int dispatch_io_event(Token_Guard &guard)
virtual int remove_handler(int signum, ACE_Sig_Action *new_disp=0, ACE_Sig_Action *old_disp=0, int sigkey=-1)
Remove an ACE_Event_Handler.
int max_size_
Maximum number of handles.
Provide a C++ wrapper for the C sigset_t interface.
int release(void)
Explicitly release the lock, but only if it is held!
ACE_Reactor_Mask mask
The event mask for the above event handler.
virtual int work_pending(const ACE_Time_Value &max_wait_time=ACE_Time_Value::zero)
virtual Reference_Count add_reference(void)
Increment reference count on the handler.
#define ACE_BIT_DISABLED(WORD, BIT)
virtual int open(ACE_Reactor_Impl *, ACE_Timer_Queue *timer_queue=0, int disable_notify=0)
virtual int read_notify_pipe(ACE_HANDLE handle, ACE_Notification_Buffer &buffer)
virtual int mask_ops(ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask, int ops)
virtual long schedule(const TYPE &type, const void *act, const ACE_Time_Value &future_time, const ACE_Time_Value &interval=ACE_Time_Value::zero)=0
int dequeue_one(ACE_Notification_Buffer &nb)
int close(ACE_HANDLE handle)
virtual int ready_ops(ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask, int ops)
struct pollfd * dp_fds_
The pollfd array that `/dev/poll' will feed its results to.
Abstract class for unblocking an ACE_Reactor_Impl from its event loop.
virtual int dispatch_notifications(int &number_of_active_handles, ACE_Handle_Set &rd_mask)
virtual int requeue_position(void)
Get position of the owner thread.
ACE_SYNCH_MUTEX repo_lock_
int register_handler_i(ACE_HANDLE handle, ACE_Event_Handler *eh, ACE_Reactor_Mask mask)
Register the given event handler with the reactor.
#define ACE_BIT_CMP_MASK(WORD, BIT, MASK)
virtual ACE_Lock & lock(void)
Returns a reference to the Reactor's internal repository lock.
ACE_Event_Handler * event_handler
The event handler.
virtual int open(size_t size, bool restart=false, ACE_Sig_Handler *=0, ACE_Timer_Queue *=0, int disable_notify_pipe=0, ACE_Reactor_Notify *=0)
Initialization.
int set_flags(ACE_HANDLE handle, int flags)
Set flags associated with handle.
int handle_events_i(ACE_Time_Value *max_wait_time, Token_Guard &guard)
virtual int max_notify_iterations(void)
size_t max_size(void) const
Returns the maximum table size.
ssize_t write(ACE_HANDLE handle, const void *buf, size_t nbyte)
ACE_Timer_Queue * timer_queue_
Defined as a pointer to allow overriding by derived classes...
struct pollfd * start_pfds_
virtual bool uses_event_associations(void)
virtual int owner(ACE_thread_t new_owner, ACE_thread_t *old_owner=0)
Transfers ownership of Reactor_Impl to the new_owner.
#define ACELIB_ERROR_RETURN(X, Y)
bool suspended
Flag that states whether or not the event handler is suspended.
void release_token(void)
Release the token ..
int mask_ops_i(ACE_HANDLE handle, ACE_Reactor_Mask mask, int ops)
int close(void)
Close down the repository.
ACE_HANDLE open(const char *filename, int mode, mode_t perms=ACE_DEFAULT_OPEN_PERMS, LPSECURITY_ATTRIBUTES sa=0)
Provides a very fast and predictable timer implementation.
bool delete_signal_handler_
int upcall(ACE_Event_Handler *event_handler, int(ACE_Event_Handler::*callback)(ACE_HANDLE), ACE_HANDLE handle)
Perform the upcall with the given event handler method.
virtual int handle_exception(ACE_HANDLE fd=ACE_INVALID_HANDLE)
Called when an exceptional events occur (e.g., SIGURG).
#define ACE_GUARD_RETURN(MUTEX, OBJ, LOCK, RETURN)
bool initialized_
Has the reactor been initialized.
int set_handle_limit(int new_limit=-1, int increase_limit_only=0)
#define ACE_SET_BITS(WORD, BITS)
virtual int notify(ACE_Event_Handler *eh=0, ACE_Reactor_Mask mask=ACE_Event_Handler::EXCEPT_MASK, ACE_Time_Value *timeout=0)=0
size_t size(void) const
Returns the current table size.
int max_notify_iterations_
ACE_Reactor_Mask mask_
Mask that indicates which method to call.
virtual int schedule_wakeup(ACE_Event_Handler *event_handler, ACE_Reactor_Mask masks_to_be_added)
Perform reference counting.
virtual int purge_pending_notifications(ACE_Event_Handler *=0, ACE_Reactor_Mask=ACE_Event_Handler::ALL_EVENTS_MASK)
Track handles we are interested for various events.
#define ACE_END_VERSIONED_NAMESPACE_DECL
bool controlled
Flag to say whether or not this handle is registered with epoll.
virtual int close(void)=0
int size_
Current number of handles.
Handler_Repository(void)
Constructor.
virtual long schedule_timer(ACE_Event_Handler *event_handler, const void *arg, const ACE_Time_Value &delay, const ACE_Time_Value &interval=ACE_Time_Value::zero)
Event_Tuple * find(ACE_HANDLE handle)
virtual int purge_pending_notifications(ACE_Event_Handler *=0, ACE_Reactor_Mask=ACE_Event_Handler::ALL_EVENTS_MASK)=0
int bind(ACE_HANDLE handle, ACE_Event_Handler *handler, ACE_Reactor_Mask mask)
ACE_Dev_Poll_Reactor(ACE_Sig_Handler *=0, ACE_Timer_Queue *=0, int disable_notify_pipe=0, ACE_Reactor_Notify *notify=0, int mask_signals=1, int s_queue=ACE_DEV_POLL_TOKEN::FIFO)
Initialize ACE_Dev_Poll_Reactor with the default size.
Set value of bits to new mask (changes the entire mask).
Value value(void) const
Current Reference_Counting_Policy.
virtual bool restart(void)
Get the existing restart value.
bool invalid_handle(ACE_HANDLE handle) const
virtual int dispatch_notify(ACE_Notification_Buffer &buffer)
sig_atomic_t deactivated_
virtual int cancel(const TYPE &type, int dont_call_handle_close=1)=0
virtual int suspend_handler(ACE_Event_Handler *event_handler)
virtual int handle_close(ACE_HANDLE handle, ACE_Reactor_Mask close_mask)
bool handle_in_range(ACE_HANDLE handle) const
int acquire_read(void)
Return 0.
int dispatch_timer_handler(Token_Guard &guard)
virtual int deactivated(void)
Event_Tuple * handlers_
The underlying array of event handlers.
Struct that collects event registration information for a handle.
ACE_ALLOC_HOOK_DEFINE(ACE_Based_Pointer_Repository_Rep)
virtual ACE_HANDLE get_handle(void) const
Get the I/O handle.
virtual int handler(ACE_HANDLE handle, ACE_Reactor_Mask mask, ACE_Event_Handler **event_handler=0)
ACE_Lock_Adapter< ACE_Dev_Poll_Reactor_Token > lock_adapter_
Adapter used to return internal lock to outside world.
virtual void wakeup_all_threads(void)
Wake up all threads waiting in the event loop.
int dispatch(Token_Guard &guard)
unsigned long msec(void) const
Converts from ACE_Time_Value format into milliseconds format.
void * memset(void *s, int c, size_t len)
Fills a buffer with a character value.
virtual int open(ACE_Reactor_Impl *, ACE_Timer_Queue *timer_queue=0, int disable_notify=0)=0
Handler_Repository handler_rep_
The repository that contains all registered event handlers.
virtual int close(void)
Close down and release all resources.
static const ACE_Time_Value zero
Constant "0".
virtual ACE_Time_Value * calculate_timeout(ACE_Time_Value *max)=0
virtual int remove_handler(ACE_Event_Handler *event_handler, ACE_Reactor_Mask mask)
Removes event_handler.
virtual int set_sig_handler(ACE_Sig_Handler *signal_handler)
Use a user specified signal handler instead.
ACE_Time_Value gettimeofday(void)
Defines a class template that allows us to invoke a member function using the GoF command style callb...
virtual int dispatch_notifications(int &number_of_active_handles, ACE_Handle_Set &rd_mask)=0
This is the abstract base class that contains the uniform locking API that is supported by all the AC...
C++ wrapper facade for the socket fd_set abstraction.
virtual Reference_Count remove_reference(void)
Decrement reference count on the handler.
#define ACE_NEW_RETURN(POINTER, CONSTRUCTOR, RET_VAL)
struct pollfd * end_pfds_
The last element in the pollfd array plus one.
virtual int handle_events(ACE_Time_Value *max_wait_time=0)
Hold signals in MASK for duration of a C++ statement block. Note that a "0" for mask causes all signa...
virtual int cancel_timer(ACE_Event_Handler *event_handler, int dont_call_handle_close=1)
virtual ACE_Event_Handler * find_handler(ACE_HANDLE handle)
virtual int reset_timer_interval(long timer_id, const ACE_Time_Value &interval)
int acquire(ACE_Time_Value *max_wait=0)
virtual void dump(void) const
Dump the state of an object.
virtual size_t size(void) const
int suspend_handler_i(ACE_HANDLE handle)
Temporarily remove the given handle from the "interest set.".
#define ACE_CLR_BITS(WORD, BITS)
int work_pending_i(ACE_Time_Value *max_wait_time)
Non-locking version of wait_pending().
Error messages (decimal 128).
virtual int expire_single(ACE_Command_Base &pre_dispatch_command)=0
virtual ACE_Event_Handler * handler(int signum)
Return the ACE_Sig_Handler associated with signum.
int remove_handler_i(ACE_HANDLE handle, ACE_Reactor_Mask mask, ACE_Guard< ACE_SYNCH_MUTEX > &repo_guard, ACE_Event_Handler *eh=0)
virtual void max_notify_iterations(int)=0
virtual int is_dispatchable(ACE_Notification_Buffer &buffer)
Verify whether the buffer has dispatchable info or not.
virtual int resume_handler(ACE_Event_Handler *event_handler)
#define ACE_NOTSUP_RETURN(FAILVALUE)
#define ACE_BIT_ENABLED(WORD, BIT)
virtual int alertable_handle_events(ACE_Time_Value *max_wait_time=0)
static int sig_pending(void)
True if there is a pending signal.
virtual int resume_handler(void)
virtual int reset_interval(long timer_id, const ACE_Time_Value &interval)=0
int ioctl(ACE_HANDLE handle, ACE_IOCTL_TYPE_ARG2 cmd, void *=0)
UNIX-style ioctl.
virtual int register_handler(int signum, ACE_Event_Handler *new_sh, ACE_Sig_Action *new_disp=0, ACE_Event_Handler **old_sh=0, ACE_Sig_Action *old_disp=0)
short reactor_mask_to_poll_event(ACE_Reactor_Mask mask)
Convert a reactor mask to its corresponding poll() event mask.
A helper class that helps grabbing, releasing and waiting on tokens for a thread that needs access to...
ACE_Dev_Poll_Reactor_Token token_
Token serializing event waiter threads.