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