ui/app,cmd/gio: move running of main from driver to GioAppDelegate

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-08-05 15:38:34 +02:00
parent 2d6111e31a
commit 8472bbc78b
3 changed files with 11 additions and 7 deletions
+9 -4
View File
@@ -7,16 +7,21 @@ package app
// library mode. To make Gio programs simpler and uniform, we'll
// link to the main function here and call it from Java.
import _ "unsafe" // for go:linkname
import (
"sync"
_ "unsafe" // for go:linkname
)
//go:linkname mainMain main.main
func mainMain()
var runMainOnce sync.Once
func runMain() {
go func() {
runMainOnce.Do(func() {
// Indirect call, since the linker does not know the address of main when
// laying down this package.
fn := mainMain
fn()
}()
go fn()
})
}