## Thread functions

Include files

<wx/thread.h>

See also

wxThread, wxMutex, Multithreading overview

::wxMutexGuiEnter
::wxMutexGuiLeave

### ::wxMutexGuiEnter

void wxMutexGuiEnter()

This function must be called when any thread other than the main GUI thread wants to get access to the GUI library. This function will block the execution of the calling thread until the main thread (or any other thread holding the main GUI lock) leaves the GUI library and no other thread will enter the GUI library until the calling thread calls ::wxMutexGuiLeave().

Typically, these functions are used like this:

    void MyThread::Foo(void)
    {
        // before doing any GUI calls we must ensure that this thread is the only
        // one doing it!

        wxMutexGuiEnter();

        // Call GUI here:
        my_window->DrawSomething();

        wxMutexGuiLeave();
    }

Note that under GTK, no creation of top-level windows is allowed in any thread but the main one.

This function is only defined on platforms which support preemptive threads.

### ::wxMutexGuiLeave

void wxMutexGuiLeave()

See ::wxMutexGuiEnter().

This function is only defined on platforms which support preemptive threads.