upipe/udeal.h header reference

Upipe exclusive access to non-reentrant resource More

Header inclusion  

Members  

Type  

Functions  

  • void udeal_abort(struct udeal *udeal, struct upump *upump)
  • void udeal_clean(struct udeal *udeal)
  • bool udeal_grab(struct udeal *udeal)
  • bool udeal_init(struct udeal *udeal)
  • void udeal_start(struct udeal *udeal, struct upump *upump)
  • struct upump * udeal_upump_alloc(struct udeal *udeal, struct upump_mgr *upump_mgr, upump_cb cb, void *opaque, struct urefcount *refcount)
  • void udeal_yield(struct udeal *udeal, struct upump *upump)

Description  

Primitives in this file allow to run a call-back when an exclusive access to a non-reentrant resource is granted, in an asynchronous, upump-aware way.

Members detail  

#define _UPIPE_UDEAL_H_  

This macro is declared in upipe/udeal.h source file, line 34.

struct udeal  

This struct is declared in upipe/udeal.h source file, line 50.

This struct is the implementation of a structure that deals access to a non-reentrant resource.

FieldDescription
uatomic_uint32_t waiters;number of waiters
uatomic_uint32_t access;number of accesses to the resource (0 or 1)
struct ueventfd event;ueventfd triggered when a waiter may be unblocked

void udeal_abort(struct udeal *udeal, struct upump *upump)  

This function is declared in upipe/udeal.h source file, line 151.

This function aborts the watcher before it has had a chance to run. It must only be called in case of abort, otherwise udeal_yield does the same job.

Parameter list:

The return value is false in case of upump error

void udeal_clean(struct udeal *udeal)  

This function is declared in upipe/udeal.h source file, line 161.

This function cleans up the udeal structure.

Parameter list:

  • udeal: pointer to a udeal structure

bool udeal_grab(struct udeal *udeal)  

This function is declared in upipe/udeal.h source file, line 114.

This function tries to grab the resource.

Parameter list:

  • udeal: pointer to a udeal structure

The return value is true if the resource may be exclusively used

bool udeal_init(struct udeal *udeal)  

This function is declared in upipe/udeal.h source file, line 65.

This function initializes a udeal.

Parameter list:

  • udeal: pointer to a udeal structure

The return value is false in case of failure

void udeal_start(struct udeal *udeal, struct upump *upump)  

This function is declared in upipe/udeal.h source file, line 99.

This function starts the watcher and tries to immediately run the call-back.

Parameter list:

struct upump * udeal_upump_alloc(struct udeal *udeal, struct upump_mgr *upump_mgr, upump_cb cb, void *opaque, struct urefcount *refcount)  

This function is declared in upipe/udeal.h source file, line 88.

This function allocates a watcher triggering when a waiter may be unblocked.

Parameter list:

  • udeal: pointer to a udeal structure
  • upump_mgr: management structure for this event loop
  • cb: function to call when the watcher triggers
  • opaque: pointer to the module's internal structure
  • refcount: pointer to urefcount structure to increment during callback, or NULL

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

void udeal_yield(struct udeal *udeal, struct upump *upump)  

This function is declared in upipe/udeal.h source file, line 136.

This function yields access to an exclusive resource previously acquired from udeal_grab, and stops the watcher.

Parameter list:

Valid XHTML 1.0 StrictGenerated by cmassiot on Fri Feb 2 23:57:19 2018 using MkDoc