diff options
| author | Pietro Gagliardi <[email protected]> | 2014-03-01 15:18:29 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-03-01 15:18:29 -0500 |
| commit | be5458c0a37cf83f2392f3951233dd3f9f406c14 (patch) | |
| tree | ae358af220f4533465ca8807157889b819dcf884 /init.go | |
| parent | c8c257f8c84c163354a2b3ba7c97bd76f2700443 (diff) | |
Major code restructure to allow Cocoa to work correctly. Cocoa requires that the application loop run on the very first OS thread created, not just an any ordinary thread. To support this, your code must now be run by the UI init code. Windows and Unix builds still work fine; Mac OS X fails for reasons I now have to debug.
Diffstat (limited to 'init.go')
| -rw-r--r-- | init.go | 23 |
1 files changed, 7 insertions, 16 deletions
@@ -1,20 +1,11 @@ // 11 february 2014 package ui -import ( - "os" -) - -func init() { - initDone := make(chan error) - go ui(initDone) - err := <-initDone - if err != nil { - // TODO provide copying instructions? will need to be system-specific - MsgBoxError("UI Library Init Failure", - "A failure occured during UI library initialization:\n%v\n" + - "Please report this to the application developer or on http://github.com/andlabs/ui.", - err) - os.Exit(1) - } +// Go sets up the UI environment and runs main in a goroutine. +// If initialization fails, Go returns an error. +// Otherwise, Go does not return to its caller until (unless? TODO) the application loop exits, at which point it returns nil. +// +// This model is undesirable, but Cocoa limitations require it. +func Go(main func()) error { + return ui(main) } |
