All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages
Functions
Turbulence Loop: socket descriptor watcher

Functions

void turbulence_loop_close (TurbulenceLoop *loop, axl_bool notify)
 
TurbulenceLoopturbulence_loop_create (TurbulenceCtx *ctx)
 
TurbulenceCtxturbulence_loop_ctx (TurbulenceLoop *loop)
 
void turbulence_loop_set_read_handler (TurbulenceLoop *loop, TurbulenceLoopOnRead on_read, axlPointer ptr, axlPointer ptr2)
 
void turbulence_loop_unwatch_descriptor (TurbulenceLoop *loop, int descriptor, axl_bool wait_until_unwatched)
 
void turbulence_loop_watch_descriptor (TurbulenceLoop *loop, int descriptor, TurbulenceLoopOnRead on_read, axlPointer ptr, axlPointer ptr2)
 
int turbulence_loop_watching (TurbulenceLoop *loop)
 

Detailed Description

Function Documentation

void turbulence_loop_close ( TurbulenceLoop loop,
axl_bool  notify 
)

Finishes the provided TurbulenceLoop, releasing resources and stopping its resources.

Parameters
loopThe loop to finish.
notifyIn the case the internal thread started by the loop should be notified to be stopped.

Referenced by turbulence_exit().

TurbulenceLoop * turbulence_loop_create ( TurbulenceCtx ctx)

Creates a new loop instance (starting a new independent thread) used to watch a list of file descriptors (usually sockets).

References error.

Referenced by turbulence_conn_mgr_setup_proxy_on_parent().

TurbulenceCtx * turbulence_loop_ctx ( TurbulenceLoop loop)

Allows to get the TurbulenceCtx associated to the provided TurbulenceLoop.

Parameters
loopThe loop where the context is being queried.
Returns
A reference to the context or NULL if it fails.
void turbulence_loop_set_read_handler ( TurbulenceLoop loop,
TurbulenceLoopOnRead  on_read,
axlPointer  ptr,
axlPointer  ptr2 
)

Allows to configure the default read handler (TurbulenceLoopOnRead) to be used by all notifications for each descriptor not having its own particular on read handler.

Parameters
loopThe loop to be configured with an on read handler.
on_readThe on read handler to be executed.
ptrThe user defined pointer to be passed to the on read handler.
ptr2Second user defined pointer to be passed to the on read handler.
void turbulence_loop_unwatch_descriptor ( TurbulenceLoop loop,
int  descriptor,
axl_bool  wait_until_unwatched 
)

Allows to unwatch the provided descriptor from the provided loop.

Parameters
loopThe loop where the descriptor will be unwatched (if found).
descriptorThe descriptor to be unwatched from the list.
wait_until_unwatchedIf axl_true, the caller will be blocked until the descriptor is removed from the waiting list, otherwise, the unwatch operation will progress without blocking.
void turbulence_loop_watch_descriptor ( TurbulenceLoop loop,
int  descriptor,
TurbulenceLoopOnRead  on_read,
axlPointer  ptr,
axlPointer  ptr2 
)

Allows to configure a descriptor to be watched, providing optionally an on read handler (TurbulenceLoopOnRead) to be used only to notify on read status on the provided descriptor.

In the case no on read handler is provided, the default handler configured at turbulence_loop_set_read_handler is used.

Parameters
loopThe loop to be configured with an on read handler.
descriptorThe file descriptor to be watched.
on_readThe on read handler to be executed.
ptrThe user defined pointer to be passed to the on read handler.
ptr2Second user defined pointer to be passed to the on read handler.

Referenced by turbulence_conn_mgr_setup_proxy_on_parent().

int turbulence_loop_watching ( TurbulenceLoop loop)

Allows to get how many descriptors are being watched on the provided loop.

Parameters
loopThe loop that is queried about the number of descriptor watched.
Returns
The number of descriptors watched. In case of failure 0 is returned.