How to use `Events` together with async event loops
- Dominant language
- C
- Stars
- 1.6k
- Forks
- 97
- PR merge metrics
- No merged PRs in 30d
Description
In async event loops like `amphp`, the main thread can sleep until a specific condition is satisfied, such as a stream is available for read/write, a child process is exited, or a time interval has passed. However, when I try to use ext-parallel inside an amphp-based program, I found that I have do busy polling with current API of `Events`, which uses a lot of CPU time. Is there anything I missed that can let me trigger an action _on the main thread asynchorously_ when an event is ready?
Contributor guide
Research direction
The issue names the Events API and amphp-based event loops but no files or tests. Start by reading the Events API and tracing how event readiness is currently polled in an amphp integration. Done means identifying a supported main-thread wake-up mechanism or clearly documenting that the current API cannot provide one.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 42/100