Thread

class Thread(val glibThreadPointer: <Error class: unknown class><<Error class: unknown class>>) : ProxyInstance(source)

The #GThread struct represents a running thread. This struct is returned by g_thread_new() or g_thread_try_new(). You can obtain the #GThread struct representing the current thread by calling g_thread_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 g_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.

Constructors

Link copied to clipboard
constructor(name: String? = null, func: ThreadFunc)

This function creates a new thread. The new thread starts by invoking

constructor()

Allocate a new Thread.

constructor(scope: <Error class: unknown class>)

Allocate a new Thread using the provided AutofreeScope.

constructor(glibThreadPointer: <Error class: unknown class><<Error class: unknown class>>)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val glibThreadPointer: <Error class: unknown class><<Error class: unknown class>>
Link copied to clipboard
open override val handle: <Error class: unknown class>

Functions

Link copied to clipboard
open override fun addCleaner(cleaner: <Error class: unknown class>): Boolean

Registers a cleaner to be executed when this proxy object is garbage collected.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Compare two proxy instances for equality. This will compare both the type of the instances, and their memory addresses.

Link copied to clipboard
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
fun join(): <Error class: unknown class>?

Waits until @thread finishes, i.e. the function @func, as given to g_thread_new(), returns or g_thread_exit() is called. If @thread has already terminated, then g_thread_join() returns immediately.

Link copied to clipboard
fun ref(): Thread

Increase the reference count on @thread.

Link copied to clipboard
open override fun removeCleaner(cleaner: <Error class: unknown class>): Boolean

Removes a previously registered cleaner from this proxy object.

Link copied to clipboard

This is deprecated since version 2.32.

Link copied to clipboard
fun unref()

Decrease the reference count on @thread, possibly freeing all resources associated with it.