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 PollerSetCapacity(Poller* poller, uint32_T capacity) Set capacity of poller.
void PollerClearEvent(Poller* poller, PollEvent event, int fd) Clear event from poller.
void PollerSetEvent(Poller* poller, PollEvent event, int fd) Set file descriptor event to poll for
bool PollerHasEvent(Poller* poller, PollEvent event, int fd) Check if event exists for file descriptor
void PollerReset(Poller* spoller) Reset poller.
Result Wait(Poller* poller, int timeout) Wait for event

Functions

PollerSetCapacity

void PollerSetCapacity(Poller* poller, uint32_T capacity)

Set capacity of poller.

PARAMETERS

Poller* poller Poller
uint32_T capacity Capacity

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

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

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

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