1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/unix/private/epolldispatcher.h
3 // Purpose: wxEpollDispatcher class
4 // Authors: Lukasz Michalski
6 // Copyright: (c) Lukasz Michalski
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_PRIVATE_EPOLLDISPATCHER_H_
12 #define _WX_PRIVATE_EPOLLDISPATCHER_H_
16 #ifdef wxUSE_EPOLL_DISPATCHER
18 #include "wx/private/fdiodispatcher.h"
22 class WXDLLIMPEXP_BASE wxEpollDispatcher
: public wxFDIODispatcher
25 // create a new instance of this class, can return NULL if
26 // epoll() is not supported on this system
28 // the caller should delete the returned pointer
29 static wxEpollDispatcher
*Create();
31 virtual ~wxEpollDispatcher();
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
);
36 virtual bool UnregisterFD(int fd
);
37 virtual bool HasPending() const;
38 virtual int Dispatch(int timeout
= TIMEOUT_INFINITE
);
41 // ctor is private, use Create()
42 wxEpollDispatcher(int epollDescriptor
);
44 // common part of HasPending() and Dispatch(): calls epoll_wait() with the
46 int DoPoll(epoll_event
*events
, int numEvents
, int timeout
) const;
49 int m_epollDescriptor
;
52 #endif // wxUSE_EPOLL_DISPATCHER
54 #endif // _WX_PRIVATE_SOCKETEVTDISPATCH_H_