-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Allow disabling of the thread checks as a "migration" - a pattern we can re-use #5425
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
Changes from all commits
88ccf5d
382bf7b
27c7b40
d6e1787
6f07422
0c2c0ef
8f4525d
3e7e92d
dfad1bf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,6 @@ | |
ID = "io.fyne.hello" | ||
Version = "2.5.3" | ||
Build = 2 | ||
|
||
[Migrations] | ||
fyneDo = true | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,29 @@ | ||
// Package build contains information about they type of build currently running. | ||
package build | ||
|
||
const DisableThreadChecks = false | ||
import ( | ||
"sync" | ||
|
||
"fyne.io/fyne/v2" | ||
) | ||
|
||
var ( | ||
migrateCheck sync.Once | ||
|
||
migratedFyneDo bool | ||
) | ||
|
||
func MigratedToFyneDo() bool { | ||
Jacalz marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if DisableThreadChecks { | ||
return true | ||
} | ||
|
||
migrateCheck.Do(func() { | ||
v, ok := fyne.CurrentApp().Metadata().Migrations["fyneDo"] | ||
if ok { | ||
migratedFyneDo = v | ||
} | ||
}) | ||
|
||
return migratedFyneDo | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//go:build migrated_fynedo | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd thing that "threading" is generic which is potentially problematic too. |
||
|
||
package build | ||
|
||
// DisableThreadChecks disables the thread safety checks for performance. | ||
const DisableThreadChecks = true | ||
Jacalz marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
//go:build !migrated_fynedo | ||
|
||
package build | ||
|
||
// DisableThreadChecks set to false enables the thread safety checks for logging of incorrect usage. | ||
const DisableThreadChecks = false | ||
Jacalz marked this conversation as resolved.
Show resolved
Hide resolved
|
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.
Same comment as further down. Maybe calling this
threading = true
would make more sense?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 assumes we will only ever have one threading migration. I'd rather be more specific
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.
Hmm, true but I'm not all too enthusiastic about the previous name either. I would like to hear what @dweymouth thinks.
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.
If we are to do a v3.0.0, then we can remove the tag and use the same tag again in the future in case we want to do one more thread migration (which I kind of think is unlikely before v3.0.0). I am still in favour of migrating threads as a better name (
fynedo
sounds a bit strange) but I approved this for now so it can land and be useful for more people.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.
Interestingly I think that re-use as you described would be a very bad thing. A migration system where what it means changes over time seems like it will be confusing and probably problematic.
Hence I'm happy we are sticking with what is here as it's explicit.