Thread
Object Hierarchy:
Description:
[ Compact ]
[ Version ( since = "2.32" ) ]
[ CCode ( ref_function = "g_thread_ref" , type_id = "G_TYPE_THREAD" , unref_function = "g_thread_unref" ) ]
public class Thread<T>
The Thread struct represents a running thread.
This struct is returned by Thread or
Thread.try. You can obtain the Thread struct
representing the current thread by calling self.
GThread is refcounted, see g_thread_ref and g_thread_unref. The thread represented by it holds a reference
while it is running, and join consumes the reference that it is given, so it is
normally not necessary to manage GThread references explicitly.
The structure is opaque -- none of its fields may be directly accessed.
Content:
Static methods:
- public static void @foreach (Func<Thread<T>> thread_func)
Call thread_func on all Thread
s that have been created with create.
- public static void @yield ()
Causes the calling thread to voluntarily relinquish the CPU, so that
other threads can run.
- public static unowned Thread<T> create<T> (owned ThreadFunc<T> func, bool joinable) throws ThreadError
This function creates a new thread.
- public static unowned Thread<T> create_full<T> (owned ThreadFunc<T> func, ulong stack_size, bool joinable, bool bound, ThreadPriority priority) throws ThreadError
This function creates a new thread.
- public static void exit (T retval)
Terminates the current thread.
- public static unowned Thread<T> self<T> ()
This function returns the Thread
corresponding to the current thread.
- public static bool supported ()
- public static void usleep (ulong microseconds)
Pauses the current thread for the given number of microseconds.
Creation methods:
Methods: