1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/unix/private/epolldispatcher.h
3 // Purpose: wxEpollDispatcher class
4 // Authors: Lukasz Michalski
6 // Copyright: (c) Lukasz Michalski
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 #ifndef _WX_PRIVATE_EPOLLDISPATCHER_H_
11 #define _WX_PRIVATE_EPOLLDISPATCHER_H_
15 #ifdef wxUSE_EPOLL_DISPATCHER
17 #include "wx/private/fdiodispatcher.h"
21 class WXDLLIMPEXP_BASE wxEpollDispatcher
: public wxFDIODispatcher
24 // create a new instance of this class, can return NULL if
25 // epoll() is not supported on this system
27 // the caller should delete the returned pointer
28 static wxEpollDispatcher
*Create();
30 virtual ~wxEpollDispatcher();
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
);
40 // ctor is private, use Create()
41 wxEpollDispatcher(int epollDescriptor
);
43 // common part of HasPending() and Dispatch(): calls epoll_wait() with the
45 int DoPoll(epoll_event
*events
, int numEvents
, int timeout
) const;
48 int m_epollDescriptor
;
51 #endif // wxUSE_EPOLL_DISPATCHER
53 #endif // _WX_PRIVATE_SOCKETEVTDISPATCH_H_