paraslash Paraslash Audio Streaming
About   News   Download   Documentation   Development

Data Fields
task_info Struct Reference

Information that must be supplied by callers of task_register(). More...

#include <sched.h>

Data Fields

const char * name
 Used for log messages and by get_task_list(). More...
 
void(* pre_monitor )(struct sched *s, void *context)
 Configure watch fds and impose an upper bound on the I/O timeout. More...
 
int(* post_monitor )(struct sched *s, void *context)
 Perform I/O on file descriptors which are ready for I/O. More...
 
void * context
 This pointer is saved when the task is registered. More...
 

Detailed Description

Information that must be supplied by callers of task_register().

Field Documentation

◆ name

const char* name

Used for log messages and by get_task_list().

◆ pre_monitor

void(* pre_monitor) (struct sched *s, void *context)

Configure watch fds and impose an upper bound on the I/O timeout.

If this is not NULL, the function is called at each iteration of the scheduler's main loop. Its purpose is to tell the scheduler that certain file descriptors should be monitored for readiness for I/O. The function may also lower the scheduler's timeout value (but shall never increase it) to impose an upper bound on the waiting time in case no file descriptors happen to be ready.

See also
time.c.

◆ post_monitor

int(* post_monitor) (struct sched *s, void *context)

Perform I/O on file descriptors which are ready for I/O.

This mandatory hook is called after the system call which monitors file descriptors returns. The function should perform non-blocking I/O on those file descriptors which are reported as being ready.

If this function returns a negative value, the scheduler unregisters the task.

Referenced by task_register().

◆ context

void* context

This pointer is saved when the task is registered.

It is passed to ->pre_monitor() and ->post_monitor(). Usually this is a pointer to the struct owned by the caller which contains the task pointer.


The documentation for this struct was generated from the following file: