You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cointop/cointop/update.go

25 lines
394 B
Go

package cointop
6 years ago
import (
"sync"
5 years ago
"github.com/jroimartin/gocui"
5 years ago
log "github.com/sirupsen/logrus"
6 years ago
)
var updateMutex sync.Mutex
// update takes a callback which updates the view
func (ct *Cointop) update(f func()) {
updateMutex.Lock()
defer updateMutex.Unlock()
5 years ago
if ct.g == nil {
log.Fatal("gocui is not initialized")
}
ct.g.Update(func(g *gocui.Gui) error {
f()
return nil
})
}