2#ifndef CLICK_SELECTSET_HH
3#define CLICK_SELECTSET_HH 1
5# error "<click/selectset.hh> only meaningful at user level"
10#if !HAVE_ALLOW_SELECT && !HAVE_ALLOW_POLL && !HAVE_ALLOW_KQUEUE
11# define HAVE_ALLOW_SELECT 1
13#if defined(__APPLE__) && HAVE_ALLOW_SELECT && HAVE_ALLOW_POLL
15# undef HAVE_ALLOW_POLL
17#if HAVE_POLL_H && HAVE_ALLOW_POLL
20# undef HAVE_ALLOW_POLL
21# if !HAVE_ALLOW_SELECT && !HAVE_ALLOW_KQUEUE
22# error "poll is not supported on this system, try --enable-select"
25#if !HAVE_SYS_EVENT_H || !HAVE_KQUEUE
26# undef HAVE_ALLOW_KQUEUE
27# if !HAVE_ALLOW_SELECT && !HAVE_ALLOW_POLL
28# error "kqueue is not supported on this system, try --enable-select"
36class SelectSet {
public:
43 int add_select(
int fd,
Element *element,
int mask);
44 int remove_select(
int fd,
Element *element,
int mask);
47 inline void wake_immediate() {
48 _wake_pipe_pending =
true;
49 ignore_result(write(_wake_pipe[1],
"", 1));
52 void kill_router(
Router *router);
63 : read(0), write(0), pollfd(-1)
69 volatile bool _wake_pipe_pending;
78 fd_set _read_select_fd_set;
79 fd_set _write_select_fd_set;
86 click_processor_t _select_processor;
89 void register_select(
int fd,
bool add_read,
bool add_write);
90 void remove_pollfd(
int pi,
int event);
91 inline void call_selected(
int fd,
int mask)
const;
92 inline bool post_select(
RouterThread *thread,
bool acquire);
103 inline void unlock();
105#if CLICK_DEBUG_MASTER || CLICK_DEBUG_SCHEDULING
115 if (click_get_processor() != _select_processor)
116 _select_lock.acquire();
124 if (click_get_processor() != _select_processor)
125 _select_lock.release();
Base class for Click elements.
Definition element.hh:42
A router configuration.
Definition router.hh:28
A set of Tasks scheduled on the same CPU.
Definition routerthread.hh:32
A non-recursive spinlock for SMP Click threads.
Definition sync.hh:587
Vector template.
Definition vector.hh:111
Classes for synchronizing among multiple CPUs, particularly in the Linux kernel.
Click's vector container template.