-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Queue binding operations without checking thread #5510
Conversation
Once fyne-io#5509 is merged, running binding callbacks from main no longer print a warning so we cna avoid checking the thread. The result is much faster performance. I also fixed a bug where we ere scheduling s.DataChanged() onto main, which then runs a trigger() which schedules other work onto main. That was unnecessary overhead.
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.
I /think/ that DataChanged
should be called on main as it is part of the public API and could be called back into user facing code.
I also fixed a bug where we were scheduling s.DataChanged() onto main, which in itself then runs a trigger() which schedules the work onto main. That was unnecessary overhead.
There may be a bug in here, but I think the right solution is slightly different.
I'm not sure I agree. We said that data bindings should be thread safe, did we not? Also, the old code was inherently wrong as it scheduled a call onto main which then just scheduled a call onto main. I don't see this being any worse than it already was. There is no functional change there in this PR, it just avoids bouncing once on main before again going to main and running the actual stuff there. |
DataChanged() for the conversion types literally only calls trigger() which itself schedules the data listener updates onto main. We don't need to call DataChanged() on ourselves from main. |
Ah, I kind of see what you mean. We would match other binding types better by just calling .trigger() in those instances. |
The core of this is that I think this is now correct. |
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.
Thanks, I think that's the threading sorted now.
Thanks. Yeah, I agree and your explanation matches my understanding as well now. Anyone actually calling DataChanged on those types would still get a double bounce on main unfortunately. Might be a problem for a future PR though |
Description:
Once #5509 is merged, running binding callbacks from main no longer print a warning so we cna avoid checking the thread. The result is much faster performance.
I also fixed a bug where we were scheduling s.DataChanged() onto main, which in itself then runs a trigger() which schedules the work onto main. That was unnecessary overhead.
Checklist: