I'm creating a new socket type[1] (neither TCP nor UDP) that I would
like to use with vibe.d. I've been writing it to use libevent and it
actually integrates rather well. The UDP connection is a pretty good
template.

The problem I have now is that I cannot arbritrarily yield and resume
tasks. The protocol multiplexes several calls over the same socket; so
a receive peeks at the current packet and resumes the task associated
with that call. My first implementation called DriverCore.resumeTask(),
but that's not accessible to other modules. My next half-thought
solution is to use ManualEvent to trigger the right call. I fear that
the recv callback could be called multiple times before the ManualEvent
gets triggered, resulting in the wrong ManualEvent reading from the
socket first or reading multiple times and consuming other calls'
packets. Are ManualEvents the right answer here or was the original
approach closer to correct?

Thanks in advance!

[1] In particular, I'm wrapping the RXRPC sockets available in the Linux
kernel -
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/rxrpc.txt?id=refs/tags/v3.18-rc6