openMSX
Public Member Functions | List of all members
openmsx::Poller Class Reference

Polls for events on a given file descriptor. More...

#include <Poller.hh>

Public Member Functions

 Poller ()
 
 ~Poller ()
 
bool poll (int fd)
 Waits for an event to occur on the given file descriptor. More...
 
bool aborted ()
 Returns true iff abort() was called. More...
 
void abort ()
 Aborts a poll in progress and any future poll attempts. More...
 

Detailed Description

Polls for events on a given file descriptor.

It is possible to abort this poll from another thread. This class exists because in POSIX there is no straightforward way to abort a blocking I/O operation.

Definition at line 13 of file Poller.hh.

Constructor & Destructor Documentation

◆ Poller()

openmsx::Poller::Poller ( )

Definition at line 12 of file Poller.cc.

◆ ~Poller()

openmsx::Poller::~Poller ( )

Definition at line 23 of file Poller.cc.

Member Function Documentation

◆ abort()

void openmsx::Poller::abort ( )

Aborts a poll in progress and any future poll attempts.

Definition at line 31 of file Poller.cc.

Referenced by aborted(), openmsx::CliConnection::end(), openmsx::SocketConnection::output(), openmsx::MidiInReader::unplugHelper(), and openmsx::RS232Tester::unplugHelper().

◆ aborted()

bool openmsx::Poller::aborted ( )
inline

Returns true iff abort() was called.

Definition at line 28 of file Poller.hh.

References abort().

Referenced by openmsx::MidiInReader::getDescription(), openmsx::RS232Tester::getDescription(), and openmsx::StdioConnection::~StdioConnection().

◆ poll()

bool openmsx::Poller::poll ( int  fd)

Waits for an event to occur on the given file descriptor.

Returns true iff abort() was called or an error occurred.

Definition at line 43 of file Poller.cc.

Referenced by openmsx::MidiInReader::getDescription(), openmsx::RS232Tester::getDescription(), openmsx::SocketConnection::~SocketConnection(), and openmsx::StdioConnection::~StdioConnection().


The documentation for this class was generated from the following files: