Method

GLibStaticPrivateset

Declaration

void
g_static_private_set (
  GStaticPrivate* private_key,
  gpointer data,
  GDestroyNotify notify
)

Description

Sets the pointer keyed to private_key for the current thread and the function notify to be called with that pointer (NULL or non-NULL), whenever the pointer is set again or whenever the current thread ends.

This function works even if g_thread_init() has not yet been called. If g_thread_init() is called later, the data keyed to private_key will be inherited only by the main thread, i.e. the one that called g_thread_init().

notify is used quite differently from destructor in g_private_new().

This method is not directly available to language bindings.

Parameters

data

Type: gpointer

The new pointer.

The argument can be NULL.
The data is owned by the caller of the function.
notify

Type: GDestroyNotify

A function to be called with the pointer whenever the current thread ends or sets this pointer again.