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 (const Poller &)=delete
 
Polleroperator= (const Poller &)=delete
 
 Poller ()
 
 ~Poller ()
 
bool poll (int fd)
 Waits for an event to occur on the given file descriptor.
 
bool aborted ()
 Returns true iff abort() was called.
 
void abort ()
 Aborts a poll in progress and any future poll attempts.
 
void reset ()
 Reset aborted() to false.
 

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 14 of file Poller.hh.

Constructor & Destructor Documentation

◆ Poller() [1/2]

openmsx::Poller::Poller ( const Poller )
delete

◆ Poller() [2/2]

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 ( )

◆ aborted()

bool openmsx::Poller::aborted ( )
inline

Returns true iff abort() was called.

Definition at line 32 of file Poller.hh.

◆ operator=()

Poller & openmsx::Poller::operator= ( const Poller )
delete

◆ 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.

References poll().

Referenced by poll().

◆ reset()

void openmsx::Poller::reset ( )
inline

Reset aborted() to false.

(Functionally the same, but more efficient than destroying and recreating this object).

Definition at line 42 of file Poller.hh.

Referenced by openmsx::MidiInReader::plugHelper(), openmsx::RS232Net::plugHelper(), and openmsx::RS232Tester::plugHelper().


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