adam-gui/vendor/fyne.io/fyne/v2/data/binding/queue.go

31 lines
402 B
Go
Raw Permalink Normal View History

2024-04-29 19:13:50 +02:00
package binding
import (
"sync"
"fyne.io/fyne/v2/internal/async"
)
var (
once sync.Once
queue *async.UnboundedFuncChan
)
func queueItem(f func()) {
once.Do(func() {
queue = async.NewUnboundedFuncChan()
go func() {
for f := range queue.Out() {
f()
}
}()
})
queue.In() <- f
}
func waitForItems() {
done := make(chan struct{})
queue.In() <- func() { close(done) }
<-done
}