Sdk file descriptor api documentation

File Descriptor functions.

Namespace: dmFileDescriptor
Include: #include <dmsdk/dlib/file_descriptor.h>
ENUMS
PollEvent Poll events
STRUCTS
struct Poller Poller
FUNCTIONS
void PollerClearEvent(Poller* poller, PollEvent event, int fd) Clear event from poller.
bool PollerHasEvent(Poller* poller, PollEvent event, int fd) Check if event exists for file descriptor
void PollerReset(Poller* spoller) Reset poller.
void PollerSetEvent(Poller* poller, PollEvent event, int fd) Set file descriptor event to poll for
Result Wait(Poller* poller, int timeout) Wait for event

Functions

PollerClearEvent

void PollerClearEvent(Poller* poller, PollEvent event, int fd)

Clear event from poller.

PARAMETERS

Poller* poller Poller
PollEvent event Event to clear
int fd File descriptor to clear

RETURNS

void

PollerHasEvent

bool PollerHasEvent(Poller* poller, PollEvent event, int fd)

Check if event exists for file descriptor

PARAMETERS

Poller* poller Poller
PollEvent event Event to check
int fd File descriptor to clear

RETURNS

bool True if event exists.

PollerReset

void PollerReset(Poller* spoller)

Reset poller.

PARAMETERS

Poller* spoller Poller

RETURNS

void

PollerSetEvent

void PollerSetEvent(Poller* poller, PollEvent event, int fd)

Set file descriptor event to poll for

PARAMETERS

Poller* poller Poller
PollEvent event Event to set
int fd File descriptor to clear

RETURNS

void

Wait

Result Wait(Poller* poller, int timeout)

Wait for event

PARAMETERS

Poller* poller Poller
int timeout Timeout. For blocking pass -1. (milliseconds)

RETURNS

Result Non-negative value on success, 0 on timeout and -1 on error with errno set to indicate the error

Structs

Poller

TYPE

struct Poller

Poller


Enums

PollEvent

Poll events

EVENT_READ
EVENT_WRITE
EVENT_ERROR