-
Notifications
You must be signed in to change notification settings - Fork 245
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
rework Ticker (fix #416) #417
Conversation
3f92a8d
to
890359a
Compare
If you're moving code around that should be in a separate commit from any other changes you make, otherwise reviewing this becomes very hard. I'm not convinced that the |
890359a
to
a1b28bc
Compare
Understood - I've moved the code back. I'd be curious what you think looks superfluous? Maybe |
a1b28bc
to
a5b571e
Compare
Also just to add some context for the changes - instead of adding a |
I feel like this is over-indexing on "we must join the thread" instead of solving the original problem of "we should make sure to do run a finish draw even if the ticker happens to hold the lock while the parent progress bar is finishing", resulting in a lot of stuff -- doubling the amount of code relating to the ticker and pulling in the additional |
IMHO a condition variable is the classic way to approach a problem like this (at least in C++), but if you can think of a different way I'd be happy to consider. |
61f9476
to
f8dae33
Compare
Yeah, so the way I have in mind is that we move the |
Sure, as long as we can guarantee that the |
I can't think of a way to write a test for this without ensuring the thread is joined. @djc were you going to try to implement your proposal, or did you want me to take a stab at it? |
I was hoping you'd write a test, once that exists I'm happy to try my hand at a fix. Does that work for you? |
As for the test, can we include the barriers in a test somehow? Or build a render test out of the long spinner example? |
Sure, I'll give it a shot! |
I don't think there is a good way to write a test for this :/. The I think the best way forward would be for you to give your approach a shot. The "test" may be for me to try to insert |
Actually, I may have just thought of a way... Will open a new PR with the test if I can get it to work. |
It's been a while but I'm back at this... I thought of a way to test it. |
I've been working on a bunch of other stuff (notably bringing chrono back to life), but am still thinking about this. I still feel like the requirement to join threads is too strong. As I understand it, the goal is that a non-ticker thread has the final draw, and it feels like we should be able to achieve that without having to join the thread. In fact, I think another goal here is that the non-ticker thread's |
FWIW this |
I pushed a work-in-progress approach that includes the barrier-based test to the Can you articulate what a |
The |
Also, I'm not convinced that joining the thread is too strong of a guarantee though I concede it may be. But at the end of the day, I'd argue it is much easier to reason about than if you try to build something with a bunch of mutexes. And it leads to simpler code. |
d501157
to
330980b
Compare
(Please ping me explicitly when you think this is ready for review -- or switch it back to draft status while it's not.) |
@djc - any further thoughts on this? I'd love to get it merged in soon. It has been working for me so far in all my testing. |
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.
Here's an initial round of feedback. I expect I'll have some more things after this stuff has been addressed.
Suggestions applied. Sorry, I didn't do it by squashing since it was too annoying (because the structs moved). |
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.
Bunch of nits, but I think this is pretty close!
41e0f3f
to
78c1fcb
Compare
Nice, thanks for seeing this through! |
Of course, thanks for your guidance and feedback :) |
Hey folks! A bisect between I don't see anything in the |
@stuhood sorry about that, and thanks for doing the bisection! Can you file a new issue to track this problem with a minimal reproduction of your issue? |
Sorry about the breakage :(
Yes, I think that's what's doing it. A short-term fix should be to add a call to |
Here's a first draft of how I think
Ticker
should work.So far the only testing I've done is to confirm that the long-spinner example works OK. I have not yet tested the modified version of it (which uses the
Barrier
s).Fixes #416.
TODO: