作者:dylanpo
项目:golang.or
func run(callbacks Callbacks) {
if tid := uint64(C.threadID()); tid != initThreadID {
log.Fatalf("app.Run called on thread %d, but app.init ran on %d", tid, initThreadID)
}
cb = callbacks
C.runApp()
}
作者:hiking9
项目:ta
func (this *Application) osLoop() {
if tid := uint64(C.threadID()); tid != sInitThreadID {
log.Fatalf("os.InitApplication called on thread %d, but core.init ran on %d", tid, sInitThreadID)
}
C.osLoop()
}
作者:dylanpo
项目:golang.or
func main(f func(screen.Screen)) error {
if tid := C.threadID(); tid != initThreadID {
log.Fatalf("gldriver.Main called on thread %d, but gldriver.init ran on %d", tid, initThreadID)
}
mainCallback = f
C.startDriver()
return nil
}
作者:SpruceHealt
项目:mobil
func init() {
// Lock the goroutine responsible for initialization to an OS thread.
// This means the goroutine running main (and calling the run function
// below) is locked to the OS thread that started the program. This is
// necessary for the correct delivery of UIKit events to the process.
//
// A discussion on this topic:
// https://groups.google.com/forum/#!msg/golang-nuts/IiWZ2hUuLDA/SNKYYZBelsYJ
runtime.LockOSThread()
initThreadID = uint64(C.threadID())
}
作者:SpruceHealt
项目:mobil
func main(f func(App)) {
if tid := uint64(C.threadID()); tid != initThreadID {
log.Fatalf("app.Run called on thread %d, but app.init ran on %d", tid, initThreadID)
}
go func() {
f(app{})
// TODO(crawshaw): trigger runApp to return
}()
C.runApp()
panic("unexpected return from app.runApp")
}
作者:andreinechae
项目:mobil
func main(f func(App)) {
if tid := uint64(C.threadID()); tid != initThreadID {
log.Fatalf("app.Main called on thread %d, but app.init ran on %d", tid, initThreadID)
}
go func() {
f(app{})
C.stopApp()
// TODO(crawshaw): trigger runApp to return
}()
C.runApp()
}