-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for configurable, custom queue type via template parameter #19
Conversation
3bf3273
to
6f5dc12
Compare
@atsushieno - I updated this and got it to work with an older version of clang, will you check it out again? |
Thanks @cjappl. I have some attempt to use it with the new QType but stuck at fixing my class for the
edit: the changeset is atsushieno@f5cf022 (also auto-linked from the commit ^) |
Alright, I have a compiling version here: https://github.com/cjappl/rtlog-cpp/tree/atsushieno_test I still need to poke at it a bit, but I tried to make the checks more explicit, and this helped me catch a few things that are off. Let me know if this works for you, or I'll report back later with more info! In case you're curious, the original problem was your class did not have a |
Ahh, with your detailed explanation now everything makes sense to me. Thank you so much! I haven't tried your exact code but locally confirmed the core change by adding value_type field (just like what readerwriterqueue does), up to the tests passing. If you don't mind, I would just hand over the rest and the overall changes (assuming that the rest of the work does not bother you. I don't care my commits remain or not). Of course if there's anything I can I'm happy to help here. |
Awesome, glad to hear it. I want to get your feedback: does this design make sense to you? As a user is it easy enough to incorporate a new queue if you wanted to? Is there any other changes to the interface that would make this more obvious or easy to use? Thanks for all your help with this one, I think a change to allow users to specify their own queue really improves rtlog, and I wouldn't have done it without your help. |
6f5dc12
to
1c2541b
Compare
#include <farbot/fifo.hpp> | ||
#include <rtlog/rtlog.h> | ||
|
||
template <typename T> class FarbotMPSCQueueWrapper { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@atsushieno I incorporated your work here as an example for future readers. Would you please review this?
I'll make sure you get marked as a co-author in the git commit, as I took much of this verbatim from your branch :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes everything looks much greater with the customizible queues! I'm glad my changes were of some help.
I don't try hard to push my MPSC stuff in the main code from "example use case", but what I'm concerned however is that people would like to have default implementation for MPSC anyway, and they would simply ask you to incorporate that farbot version (or anything equivalent) after all, just like there is the original SPSC implementation.
For my own purpose I will keep my friendly fork version (maybe not even a fork, just an addon header would work), and I'm a bit concerned that it may be more widely referenced than your original repo as people would usually want to use the logging functionality in multi-threaded apps.
As a library author in this world I understand that I wouldn't like to incorporate external deps that might not match my taste (or being asked to do so), but having third-party fork more popular (especially widely used without my fixes) would not be a great experience.
IF that were the case in the future, I'm always happy to share my stuff and feel free to take them back into this repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense.
How about this: I submit this change, then either myself or you (if you had time and wanted to) "swap" farbot and readerwriterqueue. Farbot becomes the main dependency, we add two versions of the wrapper - one single producer and one multi-producer. readerwriterqueue becomes the example dependency.
Overall, my only concern with incorporating farbot AND readerwriterqueue together is that we would be downloading more dependencies to user's machines. I already feel partly bad downloading stb, libfmt AND readerwriterqueue. Most libraries I know and trust don't download anything and are "self reliant". I would like to not add additional dependencies to the mix if possible. I agree that it is reasonable for users to want both single producer and multi producer versions of rtlog.
If we swapped in farbot as the primary queue, this would keep the dependency count the same and add more flexibility for the user. It would also be easy for anyone to add a new queue on their own if they wanted it.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be the best solution I agree :-)
I'm working on some other stuff now, but when I have time and if it's not done then I'll take the task (I don't mind overlaps, wouldn't waste too much time anyway).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. I'll ping you in any reviews if I take on the work, please do the same for me!
1c2541b
to
bcc1c3e
Compare
With the actual use case (farbot), I'm sure it is fairly easy to understand. The detailed description you left here in this issue would also help too :-) |
bcc1c3e
to
cb61a73
Compare
No description provided.