module Tkthread:sig..end
Helper functions for using LablTk with threads. To use, add tkthread.cmo or tkthread.cmx to your command line
val start : unit -> Thread.tStart the main loop in a new GUI thread. Do not use recursively.
val thread_main : unit -> unitThe actual function executed in the GUI thread
val top : Widget.toplevel Widget.widgetThe toplevel widget (an alias of Widget.default_toplevel)
Jobs are needed for Windows, as you cannot do GUI work from another thread. This is apparently true on OSX/Aqua too. And even using X11 some calls need to come from the main thread. The basic idea is to either use async (if you don't need a result) or sync whenever you call a Tk related function from another thread (for instance with the threaded toplevel). With sync, beware of deadlocks!
val async : ('a -> unit) -> 'a -> unitAdd an asynchronous job (to do in the GUI thread)
val sync : ('a -> 'b) -> 'a -> 'bAdd a synchronous job (to do in the GUI thread).
Raise Failure "Tkthread.sync" if there is no such thread.
val gui_safe : unit -> boolWhether the current thread is the GUI thread. Note that when using X11 it is generally safe to call most Tk functions from other threads too.
val running : unit -> boolWhether a GUI thread is running