Skip to content

upump-ev: use ev_async to notify remote event loop#1163

Closed
quarium wants to merge 1 commit intoUpipe:masterfrom
quarium:upump-ev-async
Closed

upump-ev: use ev_async to notify remote event loop#1163
quarium wants to merge 1 commit intoUpipe:masterfrom
quarium:upump-ev-async

Conversation

@quarium
Copy link
Copy Markdown
Contributor

@quarium quarium commented May 4, 2026

Use ev_async to notify remote event loop when an event is started from another loop.

From man ev:

ev_set_loop_release_cb
[...]
While event loop modifications are allowed between invocations of
"release" and "acquire" (that's their only purpose after all), no
modifications done will affect the event loop, i.e. adding watchers
will have no effect on the set of file descriptors being watched, or
the time waited. Use an "ev_async" watcher to wake up "ev_run" when you
want it to take note of any changes you made.
[...]

Calling a control command on a worker pipe may freeze the remote pipe
thread and forward the control command to it (for instance when calling
upipe_set_uri on a worker wrapping a source pipe).
This control command may need to add an upump in the remote event loop
(for instance an idler for initialization).
If so, when thawing the remote pipe, the remote event loop do not take
account for this upump and the upump callback will not be triggered when
needed.
Using ev_async will force the remote event loop to wake up and take
account for this new upump.

@quarium quarium marked this pull request as draft May 4, 2026 15:24
@quarium quarium requested review from cmassiot and nto May 4, 2026 15:25
@quarium quarium force-pushed the upump-ev-async branch 5 times, most recently from 0082f1a to ac00e16 Compare May 4, 2026 15:47
Use ev_async to notify remote event loop when an event is started from
another loop.

From man ev:

ev_set_loop_release_cb
[...]
While event loop modifications are allowed between invocations of
"release" and "acquire" (that's their only purpose after all), no
modifications done will affect the event loop, i.e.  adding  watchers
will  have  no effect  on  the set of file descriptors being watched, or
the time waited. Use an "ev_async" watcher to wake up "ev_run" when you
want it to take note of any changes you made.
[...]

Calling a control command on a worker pipe may freeze the remote pipe
thread and forward the control command to it (for instance when calling
upipe_set_uri on a worker wrapping a source pipe).
This control command may need to add an upump in the remote event loop
(for instance an idler for initialization).
If so, when thawing the remote pipe, the remote event loop do not take
account for this upump and the upump callback will not be triggered when
needed.
Using ev_async will force the remote event loop to wake up and take
account for this new upump.
@quarium quarium closed this May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant