upipe-modules/upipe_transfer.h header reference
Upipe module allowing to transfer other pipes to a remote event loop More
Header inclusion
Members
Types
- enum upipe_xfer_command
- enum upipe_xfer_mgr_command
Functions
- struct upipe * upipe_xfer_alloc(struct upipe_mgr *mgr, struct uprobe *uprobe, struct upipe *upipe_remote)
- struct upipe * upipe_xfer_alloc_input(struct upipe *upipe, struct upipe_mgr *upipe_mgr, struct uprobe *uprobe, struct upipe *upipe_remote)
- struct upipe * upipe_xfer_alloc_input_sub(struct upipe *upipe, struct upipe *super_pipe, struct uprobe *uprobe, struct upipe *upipe_remote)
- struct upipe * upipe_xfer_alloc_output(struct upipe *upipe, struct upipe_mgr *upipe_mgr, struct uprobe *uprobe, struct upipe *upipe_remote)
- struct upipe * upipe_xfer_alloc_output_sub(struct upipe *upipe, struct upipe *super_pipe, struct uprobe *uprobe, struct upipe *upipe_remote)
- struct upipe * upipe_xfer_alloc_sub(struct upipe *super_pipe, struct uprobe *uprobe, struct upipe *upipe_remote)
- struct upipe * upipe_xfer_chain_input(struct upipe *upipe, struct upipe_mgr *upipe_mgr, struct uprobe *uprobe, struct upipe *upipe_remote)
- struct upipe * upipe_xfer_chain_input_sub(struct upipe *upipe, struct upipe *super_pipe, struct uprobe *uprobe, struct upipe *upipe_remote)
- struct upipe * upipe_xfer_chain_output(struct upipe *upipe, struct upipe_mgr *upipe_mgr, struct uprobe *uprobe, struct upipe *upipe_remote)
- struct upipe * upipe_xfer_chain_output_sub(struct upipe *upipe, struct upipe *super_pipe, struct uprobe *uprobe, struct upipe *upipe_remote)
- struct upipe * upipe_xfer_chain_sub(struct upipe *super_pipe, struct uprobe *uprobe, struct upipe *upipe_remote)
- int upipe_xfer_get_remote(struct upipe *upipe, struct upipe **remote_p)
- struct upipe_mgr * upipe_xfer_mgr_alloc(uint8_t queue_length, uint16_t msg_pool_depth, struct umutex *mutex)
- int upipe_xfer_mgr_attach(struct upipe_mgr *mgr, struct upump_mgr *upump_mgr)
- int upipe_xfer_mgr_freeze(struct upipe_mgr *mgr)
- int upipe_xfer_mgr_thaw(struct upipe_mgr *mgr)
- int upipe_xfer_spawn_output(struct upipe *upipe, struct upipe_mgr *upipe_mgr, struct uprobe *uprobe, struct upipe *upipe_remote)
- int upipe_xfer_spawn_output_sub(struct upipe *upipe, struct upipe *super_pipe, struct uprobe *uprobe, struct upipe *upipe_remote)
Description
This is particularly helpful for multithreaded applications.
Note that the allocator requires an additional parameter:
upipe_remote | pipe to transfer to remote upump_mgr (belongs to the callee) |
---|
Members detail
This macro is declared in upipe-modules/upipe_transfer.h source file, line 48.
This macro is declared in upipe-modules/upipe_transfer.h source file, line 38.
struct upipe * upipe_xfer_alloc(struct upipe_mgr *mgr, struct uprobe *uprobe, struct upipe *upipe_remote)
This function is declared in UPIPE_HELPER_ALLOC function like macro expansion, line 15 in upipe-modules/upipe_transfer.h source file, line 152.
This function allocates and initializes a pipe from the given manager.
Please note that this function does not _use() the probe, so if you want to reuse an existing probe, you have to use it first.
Parameter list:
- mgr: management structure for this pipe type
- uprobe: structure used to raise events (belongs to the callee), followed by arguments for the allocator ()
The return value is pointer to allocated pipe, or NULL in case of failure
struct upipe * upipe_xfer_alloc_input(struct upipe *upipe, struct upipe_mgr *upipe_mgr, struct uprobe *uprobe, struct upipe *upipe_remote)
This function is declared in UPIPE_HELPER_ALLOC function like macro expansion, line 115 in upipe-modules/upipe_transfer.h source file, line 152.
This function allocates a new pipe from the given manager, and sets it as the input of the given pipe.
Please note that this function does not _use() the probe, so if you want to reuse an existing probe, you have to use it first.
Parameter list:
- upipe: description structure of the pipe
- upipe_mgr: manager for the input pipe
- uprobe: structure used to raise events (belongs to the callee), followed by arguments for the allocator ()
The return value is pointer to allocated input pipe (which must be stored or released), or NULL in case of failure
struct upipe * upipe_xfer_alloc_input_sub(struct upipe *upipe, struct upipe *super_pipe, struct uprobe *uprobe, struct upipe *upipe_remote)
This function is declared in UPIPE_HELPER_ALLOC function like macro expansion, line 284 in upipe-modules/upipe_transfer.h source file, line 152.
This function allocates a subpipe from the given super-pipe, and sets it as the input of the given pipe.
Please note that this function does not _use() the probe, so if you want to reuse an existing probe, you have to use it first.
Parameter list:
- upipe: description structure of the pipe
- super_pipe: description structure of the super-pipe
- uprobe: structure used to raise events (belongs to the callee), followed by arguments for the allocator ()
The return value is pointer to allocated input pipe (which must be stored or released), or NULL in case of failure
struct upipe * upipe_xfer_alloc_output(struct upipe *upipe, struct upipe_mgr *upipe_mgr, struct uprobe *uprobe, struct upipe *upipe_remote)
This function is declared in UPIPE_HELPER_ALLOC function like macro expansion, line 37 in upipe-modules/upipe_transfer.h source file, line 152.
This function allocates a new pipe from the given manager, and sets it as the output of the given pipe.
Please note that this function does not _use() the probe, so if you want to reuse an existing probe, you have to use it first.
Parameter list:
- upipe: description structure of the existing pipe
- upipe_mgr: manager for the output pipe
- uprobe: structure used to raise events (belongs to the callee), followed by arguments for the allocator ()
The return value is pointer to allocated output pipe (which must be stored or released), or NULL in case of failure
struct upipe * upipe_xfer_alloc_output_sub(struct upipe *upipe, struct upipe *super_pipe, struct uprobe *uprobe, struct upipe *upipe_remote)
This function is declared in UPIPE_HELPER_ALLOC function like macro expansion, line 210 in upipe-modules/upipe_transfer.h source file, line 152.
This function allocates a subpipe from the given super-pipe, and sets it as the output of the given pipe.
Please note that this function does not _use() the probe, so if you want to reuse an existing probe, you have to use it first.
Parameter list:
- upipe: description structure of the pipe
- super_pipe: description structure of the super-pipe
- uprobe: structure used to raise events (belongs to the callee) followed by arguments for the allocator ()
The return value is pointer to allocated output subpipe (which must be stored or released), or NULL in case of failure
struct upipe * upipe_xfer_alloc_sub(struct upipe *super_pipe, struct uprobe *uprobe, struct upipe *upipe_remote)
This function is declared in UPIPE_HELPER_ALLOC function like macro expansion, line 165 in upipe-modules/upipe_transfer.h source file, line 152.
This function allocates and initializes a subpipe from the given super-pipe.
Please note that this function does not _use() the probe, so if you want to reuse an existing probe, you have to use it first.
Parameter list:
- super_upipe: description structure of the super-pipe
- uprobe: structure used to raise events (belongs to the callee) followed by arguments for the allocator ()
The return value is pointer to allocated subpipe, or NULL in case of failure
struct upipe * upipe_xfer_chain_input(struct upipe *upipe, struct upipe_mgr *upipe_mgr, struct uprobe *uprobe, struct upipe *upipe_remote)
This function is declared in UPIPE_HELPER_ALLOC function like macro expansion, line 144 in upipe-modules/upipe_transfer.h source file, line 152.
This function allocates a new pipe from the given manager, sets it as the input of the given pipe, and releases it.
Please note that this function does not _use() the probe, so if you want to reuse an existing probe, you have to use it first.
Parameter list:
- upipe: description structure of the pipe (belongs to the callee)
- upipe_mgr: manager for the input pipe
- uprobe: structure used to raise events (belongs to the callee), followed by arguments for the allocator ()
The return value is pointer to allocated input pipe (which must be stored or released), or NULL in case of failure
struct upipe * upipe_xfer_chain_input_sub(struct upipe *upipe, struct upipe *super_pipe, struct uprobe *uprobe, struct upipe *upipe_remote)
This function is declared in UPIPE_HELPER_ALLOC function like macro expansion, line 309 in upipe-modules/upipe_transfer.h source file, line 152.
This function allocates a new pipe from the given manager, sets it as the input of the given pipe, and releases it.
Please note that this function does not _use() the probe, so if you want to reuse an existing probe, you have to use it first.
Parameter list:
- upipe: description structure of the pipe (belongs to the callee)
- super_pipe: description structure of the super-pipe
- uprobe: structure used to raise events (belongs to the callee), followed by arguments for the allocator ()
The return value is pointer to allocated input pipe (which must be stored or released), or NULL in case of failure
struct upipe * upipe_xfer_chain_output(struct upipe *upipe, struct upipe_mgr *upipe_mgr, struct uprobe *uprobe, struct upipe *upipe_remote)
This function is declared in UPIPE_HELPER_ALLOC function like macro expansion, line 66 in upipe-modules/upipe_transfer.h source file, line 152.
This function allocates a new pipe from the given manager, sets it as the output of the given pipe, and releases the latter.
Please note that this function does not _use() the probe, so if you want to reuse an existing probe, you have to use it first.
Parameter list:
- upipe: description structure of the pipe (belongs to the callee)
- upipe_mgr: manager for the output pipe
- uprobe: structure used to raise events (belongs to the callee), followed by arguments for the allocator ()
The return value is pointer to allocated output pipe (which must be stored or released), or NULL in case of failure
struct upipe * upipe_xfer_chain_output_sub(struct upipe *upipe, struct upipe *super_pipe, struct uprobe *uprobe, struct upipe *upipe_remote)
This function is declared in UPIPE_HELPER_ALLOC function like macro expansion, line 235 in upipe-modules/upipe_transfer.h source file, line 152.
This function allocates a subpipe from the given super-pipe, sets it as the output of the given pipe, and releases the latter.
Please note that this function does not _use() the probe, so if you want to reuse an existing probe, you have to use it first.
Parameter list:
- upipe: description structure of the pipe
- super_pipe: description structure of the super-pipe
- uprobe: structure used to raise events (belongs to the callee) followed by arguments for the allocator ()
The return value is pointer to allocated output subpipe (which must be stored or released), or NULL in case of failure
struct upipe * upipe_xfer_chain_sub(struct upipe *super_pipe, struct uprobe *uprobe, struct upipe *upipe_remote)
This function is declared in UPIPE_HELPER_ALLOC function like macro expansion, line 187 in upipe-modules/upipe_transfer.h source file, line 152.
This function allocates and initializes a subpipe from the given super-pipe, and releases the super-pipe.
Please note that this function does not _use() the probe, so if you want to reuse an existing probe, you have to use it first.
Parameter list:
- super_upipe: description structure of the super-pipe
- uprobe: structure used to raise events (belongs to the callee) followed by arguments for the allocator ()
The return value is pointer to allocated subpipe, or NULL in case of failure
This enum is declared in upipe-modules/upipe_transfer.h source file, line 52.
This enum extends upipe_command with specific commands for xfer.
Identifier | Value | Description |
---|---|---|
UPIPE_XFER_SENTINEL | UPIPE_CONTROL_LOCAL | |
UPIPE_XFER_GET_REMOTE | unknown | returns the remote pipe (struct upipe **) |
This function is declared in upipe-modules/upipe_transfer.h source file, line 70.
This function returns the remote pipe. Please note that this should only be called in the thread running upipe_xfer, and that nothing should be done on the remote pipe, unless you have stopped the remote thread and performed a memory barrier (in a way not provided by Upipe API).
Parameter list:
- upipe: description structure of the pipe
- remote_p: filled in with the remote pipe
The return value is an error code
struct upipe_mgr * upipe_xfer_mgr_alloc(uint8_t queue_length, uint16_t msg_pool_depth, struct umutex *mutex)
This function is declared in upipe-modules/upipe_transfer.h source file, line 99.
This function returns a management structure for xfer pipes. You would need one management structure per target event loop (upump manager). The management structure can be allocated in any thread, but must be attached in the same thread as the one running the upump manager.
Parameter list:
- queue_length: maximum length of the internal queues
- msg_pool_depth: maximum number of messages in the pool
- mutex: mutual exclusion primitives to access the event loop, or NULL
The return value is pointer to manager
int upipe_xfer_mgr_attach(struct upipe_mgr *mgr, struct upump_mgr *upump_mgr)
This function is declared in upipe-modules/upipe_transfer.h source file, line 117.
This function attaches a upipe_xfer_mgr to a given event loop. The xfer manager will call upump_alloc_XXX and upump_start, so it must be done in a context where it is possible, which generally means that this command is done in the same thread that runs the event loop (upump managers aren't generally thread-safe).
Please note that an xfer_mgr must be attached to a upump manager before it can be released.
Parameter list:
- mgr: xfer_mgr structure
- upump_mgr: event loop to attach
The return value is an error code
This enum is declared in upipe-modules/upipe_transfer.h source file, line 76.
This enum extends upipe_mgr_command with specific commands for xfer.
Identifier | Value | Description |
---|---|---|
UPIPE_XFER_MGR_SENTINEL | UPIPE_MGR_CONTROL_LOCAL | |
UPIPE_XFER_MGR_ATTACH | unknown | attach to given upump manager (struct upump_mgr *) |
UPIPE_XFER_MGR_FREEZE | unknown | freeze the remote event loop (void) |
UPIPE_XFER_MGR_THAW | unknown | thaw the remote event loop (void) |
This function is declared in upipe-modules/upipe_transfer.h source file, line 133.
This function freezes the remote event loop. Use this function if you need to walk through the remote pipes, send control commands or allocate subpipes of remote pipes.
This is only possible if the manager was allocated with a mutex, otherwise an error message is returned.
Parameter list:
- mgr: xfer_mgr structure
The return value is an error code
This function is declared in upipe-modules/upipe_transfer.h source file, line 144.
This function thaws the remote event loop previously frozen by upipe_xfer_mgr_freeze.
Parameter list:
- mgr: xfer_mgr structure
The return value is an error code
int upipe_xfer_spawn_output(struct upipe *upipe, struct upipe_mgr *upipe_mgr, struct uprobe *uprobe, struct upipe *upipe_remote)
This function is declared in UPIPE_HELPER_ALLOC function like macro expansion, line 90 in upipe-modules/upipe_transfer.h source file, line 152.
This function allocates a new pipe from the given manager, sets it as the output of the given pipe, and releases it.
Please note that this function does not _use() the probe, so if you want to reuse an existing probe, you have to use it first.
Parameter list:
- upipe: description structure of the pipe (belongs to the callee)
- upipe_mgr: manager for the output pipe
- uprobe: structure used to raise events (belongs to the callee), followed by arguments for the allocator ()
The return value is an error code
int upipe_xfer_spawn_output_sub(struct upipe *upipe, struct upipe *super_pipe, struct uprobe *uprobe, struct upipe *upipe_remote)
This function is declared in UPIPE_HELPER_ALLOC function like macro expansion, line 259 in upipe-modules/upipe_transfer.h source file, line 152.
This function allocates a subpipe from the given super-pipe, sets it as the output of the given pipe, and releases it.
Please note that this function does not _use() the probe, so if you want to reuse an existing probe, you have to use it first.
Parameter list:
- upipe: description structure of the pipe
- super_pipe: description structure of the super-pipe
- uprobe: structure used to raise events (belongs to the callee) followed by arguments for the allocator ()
The return value is an error code