]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: wx/unix/private/epolldispatcher.h | |
3 | // Purpose: wxEpollDispatcher class | |
4 | // Authors: Lukasz Michalski | |
5 | // Created: April 2007 | |
6 | // Copyright: (c) Lukasz Michalski | |
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 | ||
15 | #ifdef wxUSE_EPOLL_DISPATCHER | |
16 | ||
17 | #include "wx/private/fdiodispatcher.h" | |
18 | ||
19 | struct epoll_event; | |
20 | ||
21 | class WXDLLIMPEXP_BASE wxEpollDispatcher : public wxFDIODispatcher | |
22 | { | |
23 | public: | |
24 | // create a new instance of this class, can return NULL if | |
25 | // epoll() is not supported on this system | |
26 | // | |
27 | // the caller should delete the returned pointer | |
28 | static wxEpollDispatcher *Create(); | |
29 | ||
30 | virtual ~wxEpollDispatcher(); | |
31 | ||
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); | |
35 | virtual bool UnregisterFD(int fd); | |
36 | virtual bool HasPending() const; | |
37 | virtual int Dispatch(int timeout = TIMEOUT_INFINITE); | |
38 | ||
39 | private: | |
40 | // ctor is private, use Create() | |
41 | wxEpollDispatcher(int epollDescriptor); | |
42 | ||
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 | ||
48 | int m_epollDescriptor; | |
49 | }; | |
50 | ||
51 | #endif // wxUSE_EPOLL_DISPATCHER | |
52 | ||
53 | #endif // _WX_PRIVATE_SOCKETEVTDISPATCH_H_ |