Hi Kenton,
Our company is attempting to use Cap'n Proto in a soft-realtime system where we need tight control over the resolution of promises. Our problem is that we have some existing synchronous processing which needs to run frequently and timely (on the order of 100 microseconds) but our system must also service incoming RPCs (which might access results of said processing) without missing a single processing window.
What we would like to be able to do roughly corresponds the below pseudocode inside our server:
loop forever:
if before synchronous processing window:
poll single event
else:
do synchronous processing
WaitScope::poll almost fulfills our needs, but it causes all new events since the last poll to be picked up and their corresponding promises to be resolved, in this case to incoming requests, which can occasionally cause us to miss our window. Our individual RPC functions are relatively short-lived, but when receiving many in a short span of time, we encounter this timing issue.
I think what we're looking for is an overload to WaitScope::poll limiting the turn count:
Your thoughts? Otherwise could this be something that might be accepted as a small pull request?
Useful details:
- C++ 17 with official capnp/kj library
- Linux 5.x kernel (so UnixEventPort as async provider)
Rowan Reeve