blip  0.1
Looper Class Reference

Low-level Android event looper. More...

#include <Looper.hpp>

Public Member Functions

 Looper ()
 Construct a new Looper for the calling thread. More...
 
 ~Looper ()
 Destructor. More...
 
void addInputDescriptor (filedesc_t fd, uint_t id)
 Add an input descriptor to the looper's list of file descriptors to monitor. More...
 
void addOutputDescriptor (filedesc_t fd, uint_t id)
 Add an output descriptor to the looper's list of file descriptors to monitor. More...
 
void removeDescriptor (filedesc_t fd)
 Remove a file descriptor from this looper's list of file descriptors to monitor. More...
 
void interrupt ()
 Interrupt the Looper. More...
 

Static Public Member Functions

static int poll (timespan_ms_t timeout)
 Poll the Looper, returning if any of the monitored file descriptors are ready. More...
 

Detailed Description

Low-level Android event looper.

[TODO...document]

Author
Mark Lindner

Constructor & Destructor Documentation

◆ Looper()

Looper ( )

Construct a new Looper for the calling thread.

◆ ~Looper()

~Looper ( )

Destructor.

Member Function Documentation

◆ addInputDescriptor()

void addInputDescriptor ( filedesc_t  fd,
uint_t  id 
)

Add an input descriptor to the looper's list of file descriptors to monitor.

Parameters
fdThe file descriptor.
idThe event ID.

◆ addOutputDescriptor()

void addOutputDescriptor ( filedesc_t  fd,
uint_t  id 
)

Add an output descriptor to the looper's list of file descriptors to monitor.

Parameters
fdThe file descriptor.
idThe event ID.

◆ interrupt()

void interrupt ( )

Interrupt the Looper.

◆ poll()

int poll ( timespan_ms_t  timeout)
static

Poll the Looper, returning if any of the monitored file descriptors are ready.

Parameters
timeoutThe number of milliseconds to wait before timing out.
Returns
The ID of the event, of -1 if the poll timed out.
Exceptions
IOExceptionIf an I/O error occurs.
InterruptedExceptionIf the poll was interrupted via a call to interrupt().

◆ removeDescriptor()

void removeDescriptor ( filedesc_t  fd)

Remove a file descriptor from this looper's list of file descriptors to monitor.

Parameters
fdThe file descriptor.

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