Open dermesser opened 1 year ago
I'm currently also trying to understand the 0-capacity stream mechanics, and hopefully will come up with a way to (ideally) select out of a mixed set of streams.
I've added a small benchmark (f733045) which helped fix two bugs (the two preceding commits).
for #577, to supersede #578.
I want to emphasize that this change is based on my likely too superficial understanding of the library. It is likely that there exists a more elegant way to implement it.
Waiters
module slightly, which is what I had hoped to avoid by using multiple fibers previously. The way I modified it makes sense for this kind of application, but it could be that there is a race condition or logical trap I overlooked.select_of_many
does, but maybe it helps you while reviewing it :-)Locking
streams are handled at the moment, with anassert
in place to enforce this. Mostly for the reason that I've wanted to get an initial implementation going before trying to handle everything.Again, I'm not at all offended if a tighter implementation ends up replacing this PR, but my fingers were itching to try and implement it myself :-)