-
-
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
Creating a version of fyne.Do that does not wait #5448
Conversation
Naming and implementation open for discussion
I will review this further tomorrow but this does look great. The name is want I was going to suggest actually :) |
@@ -407,7 +407,7 @@ func (c *canvas) waitForDoubleTap(co fyne.CanvasObject, ev *fyne.PointEvent, tap | |||
c.touchCancelFunc = nil | |||
c.touchLastTapped = nil | |||
c.touchCancelLock.Unlock() | |||
}) | |||
}, true) |
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.
should this function call just be converted to fyne.DoAsync
?
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'm not sure - that is going out of the driver to a utility function which does thread checks then back into the driver code - feels inefficient. Either way wouldn't it be the Sync/wait/fyne.Do version?
I am wondering about naming - and defaults.. Should we change so fyne.Do, fyne.DoAsync = fyne.Wait, fyne.Do? Although our driver code will more often than not want to wait (though even the async version maintains order of operations queued...) but for app developers won't the async version be more common? i.e. "I updated a value, now go refresh"... |
Hmm. I think you are right. That does seem like a good change, though I hink I'd prefer |
I don't like fyne.Wait on its own, but fyne.DoWait could be OK. I think having the "Do" verb in common for both names is important for clarity. |
…I now get 1.2 to 1.5 million DoAsync operations per second...
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´d personally prefer WaitFor
given that DoWait
and Wait
seems to have the same logical meaning, at least to me, in the case of new names. Otherwise I'm really happy with this change. Nice catch with the more efficient thread scheduling.
What about "DoAndWait" or "DoBlock"? |
I'm a bit sceptical, sorry. I don't know what it is about it but having "block" in the name seems strange also sounds ass we are doing a block of something. I think what is in this PR is better in that case. One option is to just make |
The only naming thing I think is important is that the 2 are connected somehow, eg through a common verb like "Do", or through the I wonder if, despite the verbosity in the common case, Do/DoAsync is the best name, though DoAndWait, or even DoWait, seems fine to me |
It seems like DoAndWait may satisfy all the comments above but I will sleep on it :). |
I'm not 100% sold on |
Naming and implementation open for discussion
Checklist: