My library is eventador-rs, a lock-free pub/sub event-bus with both sync and async APIs. It's architecturally inspired by the LMAX Disruptor pattern.
I've been working on this project for a little while now. It started as an experiment on whether I could build a lock-free event-bus, and now that I have, I want to perfect it.
Aside from the possible logic bug or race condition that I may have missed, I'm particularly concerned with 3 things:
As I mentioned in the linked issue, I'm told that calling
poll_xfunction is a bad practice. In this case, I'm not sure how to resolve the call to an async function without blocking on it. Advice would be appreciated, as this is not the first time I've run into this issue.
Correct use of memory orderings in these files
Building your own lock-free data structures is usually discouraged because an inexperienced developer can misuse memory orderings and cause wacky behavior. I'm quite inexperienced in this regard, and would not be surprised if I misused the memory orderings here. However, I'd like to learn where I'm misusing them and why, so that these concepts don't remain a black-box to me.
Benchmarking concurrent data structures is quite new to me and I'm not quite sure what a fair test environment would look like, what a fair test even is, etc. Guidance on this matter would be appreciated as well.
You can find a quick summary of the overall architecture of the project here: Architecture.md.
I'm also open to contributions to improve this code, as I'll certainly be able to go over the changes and learn better practices that way as well.
Any advice or criticism would be appreciated! Thanks in advance