upipe/upump.h header reference

Upipe event loop handling More

Header inclusion  

Members  

Types  

Functions  

Macros  

Description  

Upipe event loop handling

Members detail  

#define _UPIPE_UPUMP_H_  

This macro is declared in upipe/upump.h source file, line 31.

struct upump  

This struct is declared in upipe/upump.h source file, line 77.

This struct stores a pump of a given event loop.

The structure is not refcounted and shouldn't be used by more than one thread at once.

FieldDescription
struct uchain uchain;structure for double-linked lists - for use by the allocating pipe
struct upump_mgr *mgr;pointer to the event loop manager
bool started;true if upump_start() was called on the pump
struct uchain blockers;blockers registered on this pump
upump_cb cb;function to call back when triggered
void *opaque;opaque pointer for the callback

struct upump * upump_alloc_fd_read(struct upump_mgr *mgr, upump_cb cb, void *opaque, int fd)  

This function is declared in upipe/upump.h source file, line 205.

This function allocates and initializes a pump for a readable file descriptor.

Parameters list:

  • mgr: management structure for this event loop
  • cb: function to call when the pump triggers
  • opaque: pointer to the module's internal structure
  • fd: file descriptor to watch

The return value is pointer to allocated pump, or NULL in case of failure

struct upump * upump_alloc_fd_write(struct upump_mgr *mgr, upump_cb cb, void *opaque, int fd)  

This function is declared in upipe/upump.h source file, line 220.

This function allocates and initializes a pump for a writable file descriptor.

Parameters list:

  • mgr: management structure for this event loop
  • cb: function to call when the pump triggers
  • opaque: pointer to the module's internal structure
  • fd: file descriptor to watch

The return value is pointer to allocated pump, or NULL in case of failure

struct upump * upump_alloc_idler(struct upump_mgr *mgr, upump_cb cb, void *opaque)  

This function is declared in upipe/upump.h source file, line 172.

This function allocates and initializes an idler pump.

Parameters list:

  • mgr: management structure for this event loop
  • cb: function to call when the pump triggers
  • opaque: pointer to the module's internal structure

The return value is pointer to allocated pump, or NULL in case of failure

struct upump * upump_alloc_timer(struct upump_mgr *mgr, upump_cb cb, void *opaque, uint64_t after, uint64_t repeat)  

This function is declared in upipe/upump.h source file, line 190.

This function allocates and initializes a pump for a timer.

Parameters list:

  • mgr: management structure for this event loop
  • cb: function to call when the pump triggers
  • opaque: pointer to the module's internal structure
  • after: time after which it triggers, in ticks of a 27 MHz monotonic clock
  • repeat: pump will trigger again each repeat occurrence, in ticks of a 27 MHz monotonic clock (0 to disable)

The return value is pointer to allocated pump, or NULL in case of failure

typedef void (*upump_cb)(struct upump *)   

This typedef is declared in upipe/upump.h source file, line 70.

function called when a pump is triggered

void upump_free(struct upump *upump)  

This function is declared in upipe/upump.h source file, line 248.

This function frees a struct upump structure. Please note that the pump must be stopped before.

Parameters list:

  • upump: description structure of the pump

#define upump_get_opaque(upump, type)  

This macro is declared in upipe/upump.h source file, line 257.

This macro gets the opaque structure with a cast.

Parameters list:

  • upump: description structure of the pump
  • type: type to cast to return opaque

struct upump_mgr  

This struct is declared in upipe/upump.h source file, line 107.

This struct stores common management parameters for a given event loop.

FieldDescription
struct urefcount *refcount;pointer to refcount management structure
struct uchain uchain;structure for double-linked lists - for use by the application only
void *opaque;opaque - for use by the application only
struct upump *(*upump_alloc)(struct upump_mgr *, enum upump_type , va_list ) ;function to create a pump
void (*upump_start)(struct upump *) ;function to start a pump
void (*upump_stop)(struct upump *) ;function to stop a pump
void (*upump_free)(struct upump *) ;function to free the pump
struct upump_blocker *(*upump_blocker_alloc)(struct upump *) ;function to create a blocker
void (*upump_blocker_free)(struct upump_blocker *) ;function to free the blocker
int (*upump_mgr_control)(struct upump_mgr *, int , va_list ) ;control function for standard or local manager commands - all parameters belong to the caller

See also upipe_pthread_upump_mgr_alloc typedef.

enum upump_mgr_command  

This enum is declared in upipe/upump.h source file, line 97.

This enum defines standard commands which upump managers may implement.

IdentifierValueDescription
UPUMP_MGR_VACUUM0release all buffers kept in pools (void)
UPUMP_MGR_CONTROL_LOCAL0non-standard manager commands implemented by a module type can start from there (first arg = signature)

#define upump_mgr_get_opaque(upump_mgr, type)  

This macro is declared in upipe/upump.h source file, line 300.

This macro gets the opaque member of a upump manager.

Parameters list:

  • upump_mgr: pointer to upump_mgr
  • type: type to cast to

The return value is opaque

void upump_mgr_release(struct upump_mgr *mgr)  

This function is declared in upipe/upump.h source file, line 290.

This function decrements the reference count of a upump manager of frees it.

Parameters list:

  • mgr: pointer to upump manager

void upump_mgr_set_opaque(struct upump_mgr *upump_mgr, void *opaque)  

This function is declared in upipe/upump.h source file, line 310.

This function sets the opaque member of a upump manager

Parameters list:

  • upump_mgr: pointer to upump_mgr
  • opaque: opaque

struct upump_mgr * upump_mgr_use(struct upump_mgr *mgr)  

This function is declared in upipe/upump.h source file, line 278.

This function increments the reference count of a upump manager.

Parameters list:

  • mgr: pointer to upump manager

The return value is same pointer to upump manager

int upump_mgr_vacuum(struct upump_mgr *mgr)  

This function is declared in upipe/upump.h source file, line 358.

This function instructs an existing upump manager to release all structures currently kept in pools. It is inteded as a debug tool only.

Parameters list:

  • mgr: pointer to upump manager

The return value is an error code

void upump_set_cb(struct upump *upump, upump_cb cb, void *opaque)  

This function is declared in upipe/upump.h source file, line 267.

This function sets the callback parameters of an existing pump.

Parameters list:

  • upump: description structure of the pump
  • cb: function to call when the pump triggers
  • opaque: pointer to the module's internal structure

void upump_start(struct upump *upump)  

This function is declared in upipe/upump.h source file, line 229.

This function asks the event loop to start monitoring a pump.

Parameters list:

  • pump: description structure of the pump

void upump_stop(struct upump *upump)  

This function is declared in upipe/upump.h source file, line 238.

This function asks the event loop to stop monitoring a pump.

Parameters list:

  • pump: description structure of the pump

enum upump_type  

This enum is declared in upipe/upump.h source file, line 54.

types of pumps

IdentifierValueDescription
UPUMP_TYPE_IDLER0event continuously triggers (no argument)
UPUMP_TYPE_TIMER1event triggers once after a given timeout (arguments = uint64_t, uint64_t)
UPUMP_TYPE_FD_READ2event triggers on available data from file descriptor (argument = int)
UPUMP_TYPE_FD_WRITE3event triggers on available writing space to file descriptor (argument = int)

struct upump * upump_alloc(struct upump_mgr *mgr, upump_cb cb, void *opaque, enum upump_type event, ...)  

This function is for internal use only.

This function is declared in upipe/upump.h source file, line 148.

This function allocates and initializes a pump.

Parameters list:

  • mgr: management structure for this event loop
  • cb: function to call when the pump triggers
  • opaque: pointer to the module's internal structure
  • event: type of event to watch for, followed by optional parameters

The return value is pointer to allocated pump, or NULL in case of failure

struct upump * upump_from_uchain(struct uchain *sub)  

This function is for internal use only.

This function is declared in UBASE_FROM_TO function like macro expansion, line 19 in upipe/upump.h source file, line 94.

This function returns a pointer to uchain.

Parameters list:

  • sub: pointer to struct uchain

The return value is pointer to struct upump

int upump_mgr_control(struct upump_mgr *mgr, int command, ...)  

This function is for internal use only.

This function is declared in upipe/upump.h source file, line 342.

This function sends a control command to the pipe manager. Note that thread semantics depend on the pipe manager. Also note that all arguments are owned by the caller.

Parameters list:

  • mgr: pointer to upump manager
  • command: control manager command to send, followed by optional read or write parameters

The return value is an error code

int upump_mgr_control_va(struct upump_mgr *mgr, int command, va_list args)  

This function is for internal use only.

This function is declared in upipe/upump.h source file, line 324.

This function sends a control command to the upump manager. Note that all arguments are owned by the caller.

Parameters list:

  • mgr: pointer to upump manager
  • command: manager control command to send
  • args: optional read or write parameters

The return value is an error code

struct upump_mgr * upump_mgr_from_uchain(struct uchain *sub)  

This function is for internal use only.

This function is declared in UBASE_FROM_TO function like macro expansion, line 19 in upipe/upump.h source file, line 135.

This function returns a pointer to uchain.

Parameters list:

  • sub: pointer to struct uchain

The return value is pointer to struct upump_mgr

struct uchain * upump_mgr_to_uchain(struct upump_mgr *s)  

This function is for internal use only.

This function is declared in UBASE_FROM_TO function like macro expansion, line 9 in upipe/upump.h source file, line 135.

This function returns a pointer to uchain.

Parameters list:

  • upump_mgr: pointer to struct upump_mgr

The return value is pointer to struct uchain

struct uchain * upump_to_uchain(struct upump *s)  

This function is for internal use only.

This function is declared in UBASE_FROM_TO function like macro expansion, line 9 in upipe/upump.h source file, line 94.

This function returns a pointer to uchain.

Parameters list:

  • upump: pointer to struct upump

The return value is pointer to struct uchain

Valid XHTML 1.0 StrictGenerated by cmassiot on Thu Nov 6 12:15:40 2014 using MkDoc