diamondburned/gotk4

Generate thread-safe check guards for GTK

diamondburned opened this issue · 0 comments

Since we're already code-generating all functions and methods, we can also code-generate guards that can check whether or not the user is running them in the right threads:

//go:build gotk4-thread-check

package gtk

func assertMainThread() {
    if !glib.IsMainContext() {
        panic("BUG: function called from non-main thread")
    }
}