]> git.saurik.com Git - wxWidgets.git/blob - include/wx/unix/private/epolldispatcher.h
Convert wxFSW_EVENT_{WARNING,ERROR} to string correctly.
[wxWidgets.git] / include / wx / unix / private / epolldispatcher.h
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 // 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
16 #ifdef wxUSE_EPOLL_DISPATCHER
17
18 #include "wx/private/fdiodispatcher.h"
19
20 struct epoll_event;
21
22 class WXDLLIMPEXP_BASE wxEpollDispatcher : public wxFDIODispatcher
23 {
24 public:
25 // create a new instance of this class, can return NULL if
26 // epoll() is not supported on this system
27 //
28 // the caller should delete the returned pointer
29 static wxEpollDispatcher *Create();
30
31 virtual ~wxEpollDispatcher();
32
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);
39
40 private:
41 // ctor is private, use Create()
42 wxEpollDispatcher(int epollDescriptor);
43
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
49 int m_epollDescriptor;
50 };
51
52 #endif // wxUSE_EPOLL_DISPATCHER
53
54 #endif // _WX_PRIVATE_SOCKETEVTDISPATCH_H_