glib.thread
Module for [Thread] class
Types 2
classThread : gobject.boxed.Boxed
The #GThread struct represents a running thread. This struct is returned by [glib.thread.Thread.new_] or [glib.thread.Thread.tryNew]. You can obtain the #GThread struct representing the current thread by calling [glib.thread.Thread.self].
GThread is refcounted, see [glib.thread.Thread.ref_] and [glib.thread.Thread.unref]. The thread represented by it holds a reference while it is running, and [glib.thread.Thread.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.
Methods
glib.thread.Thread tryNew(string name, glib.types.ThreadFunc func)This function is the same as [glib.thread.Thread.new_] except that it allows for the possibility of failure.void * join()Waits until thread finishes, i.e. the function func, as given to [glib.thread.Thread.new_], returns or [glib.thread.Thread.exit] is called. If thread has already terminated, then [glib.thread.Threa...void exit(void * retval = null)Terminates the current thread.glib.thread.Thread self()This function returns the #GThread corresponding to the current thread. Note that this function does not increase the reference count of the returned struct.void yield()Causes the calling thread to voluntarily relinquish the CPU, so that other threads can run.Constructors
this(string name, glib.types.ThreadFunc func)This function creates a new thread. The new thread starts by invoking func with the argument data. The thread will run until func returns or until [glib.thread.Thread.exit] is called from the new t...classThreadException : ErrorWrap