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 (const Poller &)=delete
 
 Poller (Poller &&)=delete
 
Polleroperator= (const Poller &)=delete
 
Polleroperator= (Poller &&)=delete
 
 ~Poller ()
 
bool poll (int fd)
 Waits for an event to occur on the given file descriptor.
 
bool aborted () const
 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/3]

openmsx::Poller::Poller ( )

Definition at line 12 of file Poller.cc.

◆ Poller() [2/3]

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

◆ Poller() [3/3]

openmsx::Poller::Poller ( Poller &&  )
delete

◆ ~Poller()

openmsx::Poller::~Poller ( )

Definition at line 22 of file Poller.cc.

Member Function Documentation

◆ abort()

void openmsx::Poller::abort ( )

◆ aborted()

bool openmsx::Poller::aborted ( ) const
inline

Returns true iff abort() was called.

Definition at line 33 of file Poller.hh.

◆ operator=() [1/2]

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

◆ operator=() [2/2]

Poller & openmsx::Poller::operator= ( 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 42 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 43 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: