]>
Commit | Line | Data |
---|---|---|
b46b1d59 | 1 | ///////////////////////////////////////////////////////////////////////////// |
80fdcdb9 | 2 | // Name: wx/unix/private/epolldispatcher.h |
b46b1d59 VZ |
3 | // Purpose: wxEpollDispatcher class |
4 | // Authors: Lukasz Michalski | |
5 | // Created: April 2007 | |
6 | // Copyright: (c) Lukasz Michalski | |
b46b1d59 VZ |
7 | // Licence: wxWindows licence |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef _WX_PRIVATE_EPOLLDISPATCHER_H_ | |
11 | #define _WX_PRIVATE_EPOLLDISPATCHER_H_ | |
12 | ||
13 | #include "wx/defs.h" | |
14 | ||
a1873279 | 15 | #ifdef wxUSE_EPOLL_DISPATCHER |
b46b1d59 VZ |
16 | |
17 | #include "wx/private/fdiodispatcher.h" | |
18 | ||
a12698ab VZ |
19 | struct epoll_event; |
20 | ||
cd720f7e | 21 | class WXDLLIMPEXP_BASE wxEpollDispatcher : public wxFDIODispatcher |
b46b1d59 VZ |
22 | { |
23 | public: | |
5e1eac14 | 24 | // create a new instance of this class, can return NULL if |
b46b1d59 VZ |
25 | // epoll() is not supported on this system |
26 | // | |
5e1eac14 VZ |
27 | // the caller should delete the returned pointer |
28 | static wxEpollDispatcher *Create(); | |
b46b1d59 | 29 | |
d31a4a84 VZ |
30 | virtual ~wxEpollDispatcher(); |
31 | ||
b46b1d59 VZ |
32 | // implement base class pure virtual methods |
33 | virtual bool RegisterFD(int fd, wxFDIOHandler* handler, int flags = wxFDIO_ALL); | |
34 | virtual bool ModifyFD(int fd, wxFDIOHandler* handler, int flags = wxFDIO_ALL); | |
af57c51a | 35 | virtual bool UnregisterFD(int fd); |
a12698ab VZ |
36 | virtual bool HasPending() const; |
37 | virtual int Dispatch(int timeout = TIMEOUT_INFINITE); | |
b46b1d59 VZ |
38 | |
39 | private: | |
5e1eac14 VZ |
40 | // ctor is private, use Create() |
41 | wxEpollDispatcher(int epollDescriptor); | |
b46b1d59 | 42 | |
a12698ab VZ |
43 | // common part of HasPending() and Dispatch(): calls epoll_wait() with the |
44 | // given timeout | |
45 | int DoPoll(epoll_event *events, int numEvents, int timeout) const; | |
46 | ||
47 | ||
b46b1d59 VZ |
48 | int m_epollDescriptor; |
49 | }; | |
50 | ||
a1873279 | 51 | #endif // wxUSE_EPOLL_DISPATCHER |
b46b1d59 VZ |
52 | |
53 | #endif // _WX_PRIVATE_SOCKETEVTDISPATCH_H_ |