Skip to content

Exit app from separate goroutine #11

Open
@iaburton

Description

Hello again,

I was curious if there was a way to exit the gui thread from a separate thread? Since the "main" thread is stuck in the C loop the bulk of the application is running in one or more goroutines. However if something happens and the app needs to exit, the best I can do is tell the user, and when the other goroutines quit/exit/return the main loop gets stuck and cannot exit without user intervention (the rest of the app being "dead" at this point).

A workaround is to call os.Exit after some delay to allow defered functions in the other goroutines a chance to run, but that doesn't seem very good. I'm using lxn/walk for the Windows version and it has a Synchronize function https://godoc.org/github.com/lxn/walk#WindowBase.Synchronize to call funcs from the main thread/goroutine, is something like this possible? Thanks

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions