---
name: "GtkThread"
section: "3o"
platform: "linux"
package: "liblablgtk2-ocaml-doc"
version: "2.4.0v0.2tv-8"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/GtkThread"
---

# GtkThread(3o)

The main loop to use with threads.

## NAME

GtkThread - The main loop to use with threads.

## Module

Module   GtkThread

## Documentation

Module **GtkThread**\
  :  **sig end**

The main loop to use with threads.  **GMain.main** does not work! This changes  **GMain.main** to call  **threaded\_main** rather than **GtkMain.Main.default\_main** , so subsequent calls will work. The first call sets the GUI thread, and subsequent calls to  **main** will be automatically routed through  **sync**

*val main* :  **unit -\> unit**

Start the main loop in a new GUI thread. Do not use recursively.

*val start* :  **unit -\> Thread.t**

The real main function

*val thread\_main* :  **unit -\> unit**

Forget the current GUI thread. The next call to  **main** will register its caller as GUI thread.

*val reset* :  **unit -\> unit**

*val async* :  **('a -\> unit) -\> 'a -\> unit**

Add an asynchronous job (to do in the main thread)

Add a synchronous job (to do in the main thread)

*val sync* :  **('a -\> 'b) -\> 'a -\> 'b**

Whether it is safe to call most GTK functions directly from the current thread

*val gui\_safe* :  **unit -\> bool**
