]> git.saurik.com Git - wxWidgets.git/blame - include/wx/unix/private/epolldispatcher.h
Implement monitoring of file descriptors in wxMotif event loop.
[wxWidgets.git] / include / wx / unix / private / epolldispatcher.h
CommitLineData
b46b1d59 1/////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/unix/private/epolldispatcher.h
b46b1d59
VZ
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
20struct epoll_event;
21
cd720f7e 22class WXDLLIMPEXP_BASE wxEpollDispatcher : public wxFDIODispatcher
b46b1d59
VZ
23{
24public:
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
40private:
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_