So, this started out as a practical problem, but now it's more curiosity.
Cap'n Proto uses an event loop for concurrency. I'm using another library that has its own event loop for concurrency. They refuse to use each other's event loops. Although the basic logic is the same between the two, the APIs are incompatible.
So, how do I mix two event loops?
My thought was, that if one of the event loops supports a callback when an event is queued I can essentially use one event loop to drive the other.
The basic logic would be something like the following (Python syntax, but you get the idea):
loop1 = cnp_event_loop()
loop2 = some_other_lib_event_loop()
f2 = loop2.create_future()
async def main():
res = await adapt_future(func_that_returns_a_cnp_promise())
(The function Cap'n Proto doesn't support is on_event_added() on an EventLoop.)
Just curious if anyone has any thoughts on this.