<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC '-//OASIS//DTD DocBook XML V4.5//EN'
                      'http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd' [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="glib-Deprecated-Thread-APIs">
<refmeta>
<refentrytitle role="top_of_page" id="glib-Deprecated-Thread-APIs.top_of_page">Deprecated thread API</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GLIB Library</refmiscinfo>
</refmeta>
<refnamediv>
<refname>Deprecated thread API</refname>
<refpurpose>old thread APIs (for reference only)</refpurpose>
</refnamediv>

<refsect1 id="glib-Deprecated-Thread-APIs.functions" role="functions_proto">
<title role="functions_proto.title">Functions</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="functions_proto_type" colwidth="150px"/>
<colspec colname="functions_proto_name"/>
<tbody>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-thread-init">g_thread_init</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-thread-supported">g_thread_supported</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-thread-get-initialized">g_thread_get_initialized</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GThread"><returnvalue>GThread</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-thread-create">g_thread_create</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GThread"><returnvalue>GThread</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-thread-create-full">g_thread_create_full</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-thread-set-priority">g_thread_set_priority</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-thread-foreach">g_thread_foreach</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="GMutex"><returnvalue>GMutex</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-mutex-new">g_mutex_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-mutex-free">g_mutex_free</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GCond"><returnvalue>GCond</returnvalue></link>*
</entry><entry role="function_name"><link linkend="g-cond-new">g_cond_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-cond-free">g_cond_free</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GPrivate"><returnvalue>GPrivate</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-private-new">g_private_new</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-mutex-init">g_static_mutex_init</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-mutex-lock">g_static_mutex_lock</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-mutex-trylock">g_static_mutex_trylock</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-mutex-unlock">g_static_mutex_unlock</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="GMutex"><returnvalue>GMutex</returnvalue></link>&#160;*
</entry><entry role="function_name"><link linkend="g-static-mutex-get-mutex">g_static_mutex_get_mutex</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-mutex-free">g_static_mutex_free</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-rec-mutex-init">g_static_rec_mutex_init</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-rec-mutex-lock">g_static_rec_mutex_lock</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-rec-mutex-trylock">g_static_rec_mutex_trylock</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-rec-mutex-unlock">g_static_rec_mutex_unlock</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-rec-mutex-lock-full">g_static_rec_mutex_lock_full</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="guint"><returnvalue>guint</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-rec-mutex-unlock-full">g_static_rec_mutex_unlock_full</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-rec-mutex-free">g_static_rec_mutex_free</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-rw-lock-init">g_static_rw_lock_init</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-rw-lock-reader-lock">g_static_rw_lock_reader_lock</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-rw-lock-reader-trylock">g_static_rw_lock_reader_trylock</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-rw-lock-reader-unlock">g_static_rw_lock_reader_unlock</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-rw-lock-writer-lock">g_static_rw_lock_writer_lock</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-rw-lock-writer-trylock">g_static_rw_lock_writer_trylock</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-rw-lock-writer-unlock">g_static_rw_lock_writer_unlock</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-rw-lock-free">g_static_rw_lock_free</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-private-init">g_static_private_init</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-private-get">g_static_private_get</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-private-set">g_static_private_set</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>
<row><entry role="function_type"><link linkend="void"><returnvalue>void</returnvalue></link>
</entry><entry role="function_name"><link linkend="g-static-private-free">g_static_private_free</link>&#160;<phrase role="c_punctuation">()</phrase></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>
<refsect1 id="glib-Deprecated-Thread-APIs.other" role="other_proto">
<title role="other_proto.title">Types and Values</title>
<informaltable pgwide="1" frame="none">
<tgroup cols="2">
<colspec colname="other_proto_type" colwidth="150px"/>
<colspec colname="other_proto_name"/>
<tbody>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-THREADS-IMPL-POSIX:CAPS">G_THREADS_IMPL_POSIX</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-THREADS-IMPL-WIN32:CAPS">G_THREADS_IMPL_WIN32</link></entry></row>


<row><entry role="datatype_keyword">enum</entry><entry role="function_name"><link linkend="GThreadPriority">GThreadPriority</link></entry></row>


<row><entry role="datatype_keyword"></entry><entry role="function_name"><link linkend="GStaticMutex">GStaticMutex</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-STATIC-MUTEX-INIT:CAPS">G_STATIC_MUTEX_INIT</link></entry></row>

<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GStaticRecMutex">GStaticRecMutex</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-STATIC-REC-MUTEX-INIT:CAPS">G_STATIC_REC_MUTEX_INIT</link></entry></row>

<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GStaticRWLock">GStaticRWLock</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-STATIC-RW-LOCK-INIT:CAPS">G_STATIC_RW_LOCK_INIT</link></entry></row>

<row><entry role="datatype_keyword">struct</entry><entry role="function_name"><link linkend="GStaticPrivate">GStaticPrivate</link></entry></row>
<row><entry role="define_keyword">#define</entry><entry role="function_name"><link linkend="G-STATIC-PRIVATE-INIT:CAPS">G_STATIC_PRIVATE_INIT</link></entry></row>

</tbody>
</tgroup>
</informaltable>
</refsect1>

<refsect1 id="glib-Deprecated-Thread-APIs.includes"><title>Includes</title><synopsis>#include &lt;glib.h&gt;
</synopsis></refsect1>

<refsect1 id="glib-Deprecated-Thread-APIs.description" role="desc">
<title role="desc.title">Description</title>
<para>These APIs are deprecated.  You should not use them in new code.
This section remains only to assist with understanding code that was
written to use these APIs at some point in the past.</para>

</refsect1>
<refsect1 id="glib-Deprecated-Thread-APIs.functions_details" role="details">
<title role="details.title">Functions</title>
<refsect2 id="g-thread-init" role="function" condition="deprecated">
<title>g_thread_init&#160;()</title>
<indexterm zone="g-thread-init" role="deprecated"><primary sortas="thread_init">g_thread_init</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_thread_init (<parameter><link linkend="gpointer"><type>gpointer</type></link> vtable</parameter>);</programlisting>
<warning><para><literal>g_thread_init</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>This function is no longer necessary. The GLib
    threading system is automatically initialized at the start
    of your program.</para>
</warning>
<para>If you use GLib from more than one thread, you must initialize the
thread system by calling <link linkend="g-thread-init"><function>g_thread_init()</function></link>.</para>
<para>Since version 2.24, calling <link linkend="g-thread-init"><function>g_thread_init()</function></link> multiple times is allowed,
but nothing happens except for the first call.</para>
<para>Since version 2.32, GLib does not support custom thread implementations
anymore and the <parameter>vtable</parameter>
 parameter is ignored and you should pass <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<para>&lt;note>&lt;para><link linkend="g-thread-init"><function>g_thread_init()</function></link> must not be called directly or indirectly
in a callback from GLib. Also no mutexes may be currently locked while
calling <link linkend="g-thread-init"><function>g_thread_init()</function></link>.&lt;/para>&lt;/note></para>
<para>&lt;note>&lt;para>To use <link linkend="g-thread-init"><function>g_thread_init()</function></link> in your program, you have to link
with the libraries that the command &lt;command>pkg-config --libs
gthread-2.0&lt;/command> outputs. This is not the case for all the
other thread-related functions of GLib. Those can be used without
having to link with the thread libraries.&lt;/para>&lt;/note></para>
<refsect3 id="g-thread-init.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>vtable</para></entry>
<entry role="parameter_description"><para>a function table of type <link linkend="GThreadFunctions"><type>GThreadFunctions</type></link>, that provides
the entry points to the thread system to be used. Since 2.32,
this parameter is ignored and should always be <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-thread-supported" role="function">
<title>g_thread_supported&#160;()</title>
<indexterm zone="g-thread-supported"><primary sortas="thread_supported">g_thread_supported</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_thread_supported ();</programlisting>
<para>This macro returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if the thread system is initialized,
and <link linkend="FALSE:CAPS"><literal>FALSE</literal></link> if it is not.</para>
<para>For language bindings, <link linkend="g-thread-get-initialized"><function>g_thread_get_initialized()</function></link> provides
the same functionality as a function.</para>
<refsect3 id="g-thread-supported.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, if the thread system is initialized</para>
</refsect3></refsect2>
<refsect2 id="g-thread-get-initialized" role="function" condition="deprecated:|since:2.20">
<title>g_thread_get_initialized&#160;()</title>
<indexterm zone="g-thread-get-initialized" role="deprecated"><primary sortas="thread_get_initialized">g_thread_get_initialized</primary></indexterm><indexterm zone="g-thread-get-initialized" role="2.20"><primary sortas="thread_get_initialized">g_thread_get_initialized</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_thread_get_initialized (<parameter><type>void</type></parameter>);</programlisting>
<warning><para><literal>g_thread_get_initialized</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>Indicates if <link linkend="g-thread-init"><function>g_thread_init()</function></link> has been called.</para>
<refsect3 id="g-thread-get-initialized.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link> if threads have been initialized.</para>
</refsect3><para role="since">Since: <link linkend="api-index-2.20">2.20</link></para></refsect2>
<refsect2 id="g-thread-create" role="function" condition="deprecated:2.32: Use g_thread_new() instead">
<title>g_thread_create&#160;()</title>
<indexterm zone="g-thread-create" role="deprecated"><primary sortas="thread_create">g_thread_create</primary></indexterm>
<programlisting language="C"><link linkend="GThread"><returnvalue>GThread</returnvalue></link>&#160;*
g_thread_create (<parameter><link linkend="GThreadFunc"><type>GThreadFunc</type></link> func</parameter>,
                 <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>,
                 <parameter><link linkend="gboolean"><type>gboolean</type></link> joinable</parameter>,
                 <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<warning><para><literal>g_thread_create</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-thread-new"><function>g_thread_new()</function></link> instead</para>
</warning>
<para>This function creates a new thread.</para>
<para>The new thread executes the function <parameter>func</parameter>
 with the argument <parameter>data</parameter>
.
If the thread was created successfully, it is returned.</para>
<para><parameter>error</parameter>
 can be <link linkend="NULL:CAPS"><literal>NULL</literal></link> to ignore errors, or non-<link linkend="NULL:CAPS"><literal>NULL</literal></link> to report errors.
The error is set, if and only if the function returns <link linkend="NULL:CAPS"><literal>NULL</literal></link>.</para>
<para>This function returns a reference to the created thread only if
<parameter>joinable</parameter>
 is <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>.  In that case, you must free this reference by
calling <link linkend="g-thread-unref"><function>g_thread_unref()</function></link> or <link linkend="g-thread-join"><function>g_thread_join()</function></link>.  If <parameter>joinable</parameter>
 is <link linkend="FALSE:CAPS"><literal>FALSE</literal></link>
then you should probably not touch the return value.</para>
<refsect3 id="g-thread-create.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>func</para></entry>
<entry role="parameter_description"><para>a function to execute in the new thread</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>an argument to supply to the new thread</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>joinable</para></entry>
<entry role="parameter_description"><para>should this thread be joinable?</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>return location for error, or <link linkend="NULL:CAPS"><literal>NULL</literal></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-thread-create.returns" role="returns">
<title>Returns</title>
<para> the new <link linkend="GThread"><type>GThread</type></link> on success</para>
</refsect3></refsect2>
<refsect2 id="g-thread-create-full" role="function" condition="deprecated">
<title>g_thread_create_full&#160;()</title>
<indexterm zone="g-thread-create-full" role="deprecated"><primary sortas="thread_create_full">g_thread_create_full</primary></indexterm>
<programlisting language="C"><link linkend="GThread"><returnvalue>GThread</returnvalue></link>&#160;*
g_thread_create_full (<parameter><link linkend="GThreadFunc"><type>GThreadFunc</type></link> func</parameter>,
                      <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>,
                      <parameter><link linkend="gulong"><type>gulong</type></link> stack_size</parameter>,
                      <parameter><link linkend="gboolean"><type>gboolean</type></link> joinable</parameter>,
                      <parameter><link linkend="gboolean"><type>gboolean</type></link> bound</parameter>,
                      <parameter><link linkend="GThreadPriority"><type>GThreadPriority</type></link> priority</parameter>,
                      <parameter><link linkend="GError"><type>GError</type></link> **error</parameter>);</programlisting>
<warning><para><literal>g_thread_create_full</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>The <parameter>bound</parameter>
 and <parameter>priority</parameter>
 arguments are now ignored.
Use <link linkend="g-thread-new"><function>g_thread_new()</function></link>.</para>
</warning>
<para>This function creates a new thread.</para>
<refsect3 id="g-thread-create-full.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>func</para></entry>
<entry role="parameter_description"><para>a function to execute in the new thread.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>an argument to supply to the new thread.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>stack_size</para></entry>
<entry role="parameter_description"><para>a stack size for the new thread.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>joinable</para></entry>
<entry role="parameter_description"><para>should this thread be joinable?</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>bound</para></entry>
<entry role="parameter_description"><para>ignored</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>priority</para></entry>
<entry role="parameter_description"><para>ignored</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>error</para></entry>
<entry role="parameter_description"><para>return location for error.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-thread-create-full.returns" role="returns">
<title>Returns</title>
<para> the new <link linkend="GThread"><type>GThread</type></link> on success.</para>
</refsect3></refsect2>
<refsect2 id="g-thread-set-priority" role="function" condition="deprecated:2.32: Thread priorities no longer have any effect.">
<title>g_thread_set_priority&#160;()</title>
<indexterm zone="g-thread-set-priority" role="deprecated"><primary sortas="thread_set_priority">g_thread_set_priority</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_thread_set_priority (<parameter><link linkend="GThread"><type>GThread</type></link> *thread</parameter>,
                       <parameter><link linkend="GThreadPriority"><type>GThreadPriority</type></link> priority</parameter>);</programlisting>
<warning><para><literal>g_thread_set_priority</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Thread priorities no longer have any effect.</para>
</warning>
<para>This function does nothing.</para>
<refsect3 id="g-thread-set-priority.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>thread</para></entry>
<entry role="parameter_description"><para>a <link linkend="GThread"><type>GThread</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>priority</para></entry>
<entry role="parameter_description"><para>ignored</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-thread-foreach" role="function" condition="deprecated|since:2.10">
<title>g_thread_foreach&#160;()</title>
<indexterm zone="g-thread-foreach" role="deprecated"><primary sortas="thread_foreach">g_thread_foreach</primary></indexterm><indexterm zone="g-thread-foreach" role="2.10"><primary sortas="thread_foreach">g_thread_foreach</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_thread_foreach (<parameter><link linkend="GFunc"><type>GFunc</type></link> thread_func</parameter>,
                  <parameter><link linkend="gpointer"><type>gpointer</type></link> user_data</parameter>);</programlisting>
<warning><para><literal>g_thread_foreach</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>There aren't many things you can do with a <link linkend="GThread"><type>GThread</type></link>,
    except comparing it with one that was returned from <link linkend="g-thread-create"><function>g_thread_create()</function></link>.
    There are better ways to find out if your thread is still alive.</para>
</warning>
<para>Call <parameter>thread_func</parameter>
 on all <link linkend="GThreads"><type>GThreads</type></link> that have been
created with <link linkend="g-thread-create"><function>g_thread_create()</function></link>.</para>
<para>Note that threads may decide to exit while <parameter>thread_func</parameter>
 is
running, so without intimate knowledge about the lifetime of
foreign threads, <parameter>thread_func</parameter>
 shouldn't access the GThread*
pointer passed in as first argument. However, <parameter>thread_func</parameter>
 will
not be called for threads which are known to have exited already.</para>
<para>Due to thread lifetime checks, this function has an execution complexity
which is quadratic in the number of existing threads.</para>
<refsect3 id="g-thread-foreach.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>thread_func</para></entry>
<entry role="parameter_description"><para>function to call for all <link linkend="GThread"><type>GThread</type></link> structures</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>user_data</para></entry>
<entry role="parameter_description"><para>second argument to <parameter>thread_func</parameter>
</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><para role="since">Since: <link linkend="api-index-2.10">2.10</link></para></refsect2>
<refsect2 id="g-mutex-new" role="function" condition="deprecated">
<title>g_mutex_new&#160;()</title>
<indexterm zone="g-mutex-new" role="deprecated"><primary sortas="mutex_new">g_mutex_new</primary></indexterm>
<programlisting language="C"><link linkend="GMutex"><returnvalue>GMutex</returnvalue></link>&#160;*
g_mutex_new ();</programlisting>
<warning><para><literal>g_mutex_new</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>GMutex can now be statically allocated, or embedded
in structures and initialised with <link linkend="g-mutex-init"><function>g_mutex_init()</function></link>.</para>
</warning>
<para>Allocates and initializes a new <link linkend="GMutex"><type>GMutex</type></link>.</para>
<refsect3 id="g-mutex-new.returns" role="returns">
<title>Returns</title>
<para> a newly allocated <link linkend="GMutex"><type>GMutex</type></link>. Use <link linkend="g-mutex-free"><function>g_mutex_free()</function></link> to free</para>
</refsect3></refsect2>
<refsect2 id="g-mutex-free" role="function" condition="deprecated">
<title>g_mutex_free&#160;()</title>
<indexterm zone="g-mutex-free" role="deprecated"><primary sortas="mutex_free">g_mutex_free</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_mutex_free (<parameter><link linkend="GMutex"><type>GMutex</type></link> *mutex</parameter>);</programlisting>
<warning><para><literal>g_mutex_free</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>GMutex can now be statically allocated, or embedded
in structures and initialised with <link linkend="g-mutex-init"><function>g_mutex_init()</function></link>.</para>
</warning>
<para>Destroys a <parameter>mutex</parameter>
 that has been created with <link linkend="g-mutex-new"><function>g_mutex_new()</function></link>.</para>
<para>Calling <link linkend="g-mutex-free"><function>g_mutex_free()</function></link> on a locked mutex may result
in undefined behaviour.</para>
<refsect3 id="g-mutex-free.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>mutex</para></entry>
<entry role="parameter_description"><para>a <link linkend="GMutex"><type>GMutex</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-cond-new" role="function" condition="deprecated">
<title>g_cond_new&#160;()</title>
<indexterm zone="g-cond-new" role="deprecated"><primary sortas="cond_new">g_cond_new</primary></indexterm>
<programlisting language="C"><link linkend="GCond"><returnvalue>GCond</returnvalue></link>*
g_cond_new ();</programlisting>
<warning><para><literal>g_cond_new</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>GCond can now be statically allocated, or embedded
in structures and initialised with <link linkend="g-cond-init"><function>g_cond_init()</function></link>.</para>
</warning>
<para>Allocates and initializes a new <link linkend="GCond"><type>GCond</type></link>.</para>
<refsect3 id="g-cond-new.returns" role="returns">
<title>Returns</title>
<para> a newly allocated <link linkend="GCond"><type>GCond</type></link>. Free with <link linkend="g-cond-free"><function>g_cond_free()</function></link></para>
</refsect3></refsect2>
<refsect2 id="g-cond-free" role="function" condition="deprecated">
<title>g_cond_free&#160;()</title>
<indexterm zone="g-cond-free" role="deprecated"><primary sortas="cond_free">g_cond_free</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_cond_free (<parameter><link linkend="GCond"><type>GCond</type></link> *cond</parameter>);</programlisting>
<warning><para><literal>g_cond_free</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>GCond can now be statically allocated, or embedded
in structures and initialised with <link linkend="g-cond-init"><function>g_cond_init()</function></link>.</para>
</warning>
<para>Destroys a <link linkend="GCond"><type>GCond</type></link> that has been created with <link linkend="g-cond-new"><function>g_cond_new()</function></link>.</para>
<para>Calling <link linkend="g-cond-free"><function>g_cond_free()</function></link> for a <link linkend="GCond"><type>GCond</type></link> on which threads are
blocking leads to undefined behaviour.</para>
<refsect3 id="g-cond-free.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>cond</para></entry>
<entry role="parameter_description"><para>a <link linkend="GCond"><type>GCond</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-private-new" role="function" condition="deprecated">
<title>g_private_new&#160;()</title>
<indexterm zone="g-private-new" role="deprecated"><primary sortas="private_new">g_private_new</primary></indexterm>
<programlisting language="C"><link linkend="GPrivate"><returnvalue>GPrivate</returnvalue></link>&#160;*
g_private_new (<parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> notify</parameter>);</programlisting>
<warning><para><literal>g_private_new</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>dynamic allocation of <link linkend="GPrivate"><type>GPrivate</type></link> is a bad idea.  Use
                 static storage and <link linkend="G-PRIVATE-INIT:CAPS"><function>G_PRIVATE_INIT()</function></link> instead.</para>
</warning>
<para>Creates a new <link linkend="GPrivate"><type>GPrivate</type></link>.</para>
<refsect3 id="g-private-new.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>notify</para></entry>
<entry role="parameter_description"><para>a <link linkend="GDestroyNotify"><type>GDestroyNotify</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-private-new.returns" role="returns">
<title>Returns</title>
<para> a newly allocated <link linkend="GPrivate"><type>GPrivate</type></link> (which can never be destroyed)</para>
</refsect3></refsect2>
<refsect2 id="g-static-mutex-init" role="function" condition="deprecated:2.32: Use g_mutex_init()">
<title>g_static_mutex_init&#160;()</title>
<indexterm zone="g-static-mutex-init" role="deprecated"><primary sortas="static_mutex_init">g_static_mutex_init</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_mutex_init (<parameter><link linkend="GStaticMutex"><type>GStaticMutex</type></link> *mutex</parameter>);</programlisting>
<warning><para><literal>g_static_mutex_init</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-mutex-init"><function>g_mutex_init()</function></link></para>
</warning>
<para>Initializes <parameter>mutex</parameter>
.
Alternatively you can initialize it with <link linkend="G-STATIC-MUTEX-INIT:CAPS"><type>G_STATIC_MUTEX_INIT</type></link>.</para>
<refsect3 id="g-static-mutex-init.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>mutex</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticMutex"><type>GStaticMutex</type></link> to be initialized.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-static-mutex-lock" role="function" condition="deprecated:2.32: Use g_mutex_lock()">
<title>g_static_mutex_lock&#160;()</title>
<indexterm zone="g-static-mutex-lock" role="deprecated"><primary sortas="static_mutex_lock">g_static_mutex_lock</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_mutex_lock (<parameter><link linkend="GStaticMutex"><type>GStaticMutex</type></link> *mutex</parameter>);</programlisting>
<warning><para><literal>g_static_mutex_lock</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-mutex-lock"><function>g_mutex_lock()</function></link></para>
</warning>
<para>Works like <link linkend="g-mutex-lock"><function>g_mutex_lock()</function></link>, but for a <link linkend="GStaticMutex"><type>GStaticMutex</type></link>.</para>
<refsect3 id="g-static-mutex-lock.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>mutex</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticMutex"><type>GStaticMutex</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-static-mutex-trylock" role="function" condition="deprecated:2.32: Use g_mutex_trylock()">
<title>g_static_mutex_trylock&#160;()</title>
<indexterm zone="g-static-mutex-trylock" role="deprecated"><primary sortas="static_mutex_trylock">g_static_mutex_trylock</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_static_mutex_trylock (<parameter><link linkend="GStaticMutex"><type>GStaticMutex</type></link> *mutex</parameter>);</programlisting>
<warning><para><literal>g_static_mutex_trylock</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-mutex-trylock"><function>g_mutex_trylock()</function></link></para>
</warning>
<para>Works like <link linkend="g-mutex-trylock"><function>g_mutex_trylock()</function></link>, but for a <link linkend="GStaticMutex"><type>GStaticMutex</type></link>.</para>
<refsect3 id="g-static-mutex-trylock.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>mutex</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticMutex"><type>GStaticMutex</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-static-mutex-trylock.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, if the <link linkend="GStaticMutex"><type>GStaticMutex</type></link> could be locked.</para>
</refsect3></refsect2>
<refsect2 id="g-static-mutex-unlock" role="function" condition="deprecated:2.32: Use g_mutex_unlock()">
<title>g_static_mutex_unlock&#160;()</title>
<indexterm zone="g-static-mutex-unlock" role="deprecated"><primary sortas="static_mutex_unlock">g_static_mutex_unlock</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_mutex_unlock (<parameter><link linkend="GStaticMutex"><type>GStaticMutex</type></link> *mutex</parameter>);</programlisting>
<warning><para><literal>g_static_mutex_unlock</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-mutex-unlock"><function>g_mutex_unlock()</function></link></para>
</warning>
<para>Works like <link linkend="g-mutex-unlock"><function>g_mutex_unlock()</function></link>, but for a <link linkend="GStaticMutex"><type>GStaticMutex</type></link>.</para>
<refsect3 id="g-static-mutex-unlock.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>mutex</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticMutex"><type>GStaticMutex</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-static-mutex-get-mutex" role="function" condition="deprecated:2.32: Just use a #GMutex">
<title>g_static_mutex_get_mutex&#160;()</title>
<indexterm zone="g-static-mutex-get-mutex" role="deprecated"><primary sortas="static_mutex_get_mutex">g_static_mutex_get_mutex</primary></indexterm>
<programlisting language="C"><link linkend="GMutex"><returnvalue>GMutex</returnvalue></link>&#160;*
g_static_mutex_get_mutex (<parameter><link linkend="GStaticMutex"><type>GStaticMutex</type></link> *mutex</parameter>);</programlisting>
<warning><para><literal>g_static_mutex_get_mutex</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Just use a <link linkend="GMutex"><type>GMutex</type></link></para>
</warning>
<para>For some operations (like <link linkend="g-cond-wait"><function>g_cond_wait()</function></link>) you must have a <link linkend="GMutex"><type>GMutex</type></link>
instead of a <link linkend="GStaticMutex"><type>GStaticMutex</type></link>. This function will return the
corresponding <link linkend="GMutex"><type>GMutex</type></link> for <parameter>mutex</parameter>
.</para>
<refsect3 id="g-static-mutex-get-mutex.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>mutex</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticMutex"><type>GStaticMutex</type></link>.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-static-mutex-get-mutex.returns" role="returns">
<title>Returns</title>
<para> the <link linkend="GMutex"><type>GMutex</type></link> corresponding to <parameter>mutex</parameter>
.</para>
</refsect3></refsect2>
<refsect2 id="g-static-mutex-free" role="function" condition="deprecated:2.32: Use g_mutex_clear()">
<title>g_static_mutex_free&#160;()</title>
<indexterm zone="g-static-mutex-free" role="deprecated"><primary sortas="static_mutex_free">g_static_mutex_free</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_mutex_free (<parameter><link linkend="GStaticMutex"><type>GStaticMutex</type></link> *mutex</parameter>);</programlisting>
<warning><para><literal>g_static_mutex_free</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-mutex-clear"><function>g_mutex_clear()</function></link></para>
</warning>
<para>Releases all resources allocated to <parameter>mutex</parameter>
.</para>
<para>You don't have to call this functions for a <link linkend="GStaticMutex"><type>GStaticMutex</type></link> with an
unbounded lifetime, i.e. objects declared 'static', but if you have
a <link linkend="GStaticMutex"><type>GStaticMutex</type></link> as a member of a structure and the structure is
freed, you should also free the <link linkend="GStaticMutex"><type>GStaticMutex</type></link>.</para>
<para>Calling <link linkend="g-static-mutex-free"><function>g_static_mutex_free()</function></link> on a locked mutex may result in
undefined behaviour.</para>
<refsect3 id="g-static-mutex-free.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>mutex</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticMutex"><type>GStaticMutex</type></link> to be freed.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-static-rec-mutex-init" role="function" condition="deprecated:2.32: Use g_rec_mutex_init()">
<title>g_static_rec_mutex_init&#160;()</title>
<indexterm zone="g-static-rec-mutex-init" role="deprecated"><primary sortas="static_rec_mutex_init">g_static_rec_mutex_init</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_rec_mutex_init (<parameter><link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> *mutex</parameter>);</programlisting>
<warning><para><literal>g_static_rec_mutex_init</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-rec-mutex-init"><function>g_rec_mutex_init()</function></link></para>
</warning>
<para>A <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> must be initialized with this function before it
can be used. Alternatively you can initialize it with
<link linkend="G-STATIC-REC-MUTEX-INIT:CAPS"><type>G_STATIC_REC_MUTEX_INIT</type></link>.</para>
<refsect3 id="g-static-rec-mutex-init.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>mutex</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> to be initialized.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-static-rec-mutex-lock" role="function" condition="deprecated:2.32: Use g_rec_mutex_lock()">
<title>g_static_rec_mutex_lock&#160;()</title>
<indexterm zone="g-static-rec-mutex-lock" role="deprecated"><primary sortas="static_rec_mutex_lock">g_static_rec_mutex_lock</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_rec_mutex_lock (<parameter><link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> *mutex</parameter>);</programlisting>
<warning><para><literal>g_static_rec_mutex_lock</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-rec-mutex-lock"><function>g_rec_mutex_lock()</function></link></para>
</warning>
<para>Locks <parameter>mutex</parameter>
. If <parameter>mutex</parameter>
 is already locked by another thread, the
current thread will block until <parameter>mutex</parameter>
 is unlocked by the other
thread. If <parameter>mutex</parameter>
 is already locked by the calling thread, this
functions increases the depth of <parameter>mutex</parameter>
 and returns immediately.</para>
<refsect3 id="g-static-rec-mutex-lock.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>mutex</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> to lock.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-static-rec-mutex-trylock" role="function" condition="deprecated:2.32: Use g_rec_mutex_trylock()">
<title>g_static_rec_mutex_trylock&#160;()</title>
<indexterm zone="g-static-rec-mutex-trylock" role="deprecated"><primary sortas="static_rec_mutex_trylock">g_static_rec_mutex_trylock</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_static_rec_mutex_trylock (<parameter><link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> *mutex</parameter>);</programlisting>
<warning><para><literal>g_static_rec_mutex_trylock</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-rec-mutex-trylock"><function>g_rec_mutex_trylock()</function></link></para>
</warning>
<para>Tries to lock <parameter>mutex</parameter>
. If <parameter>mutex</parameter>
 is already locked by another thread,
it immediately returns <link linkend="FALSE:CAPS"><literal>FALSE</literal></link>. Otherwise it locks <parameter>mutex</parameter>
 and returns
<link linkend="TRUE:CAPS"><literal>TRUE</literal></link>. If <parameter>mutex</parameter>
 is already locked by the calling thread, this
functions increases the depth of <parameter>mutex</parameter>
 and immediately returns
<link linkend="TRUE:CAPS"><literal>TRUE</literal></link>.</para>
<refsect3 id="g-static-rec-mutex-trylock.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>mutex</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> to lock.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-static-rec-mutex-trylock.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, if <parameter>mutex</parameter>
could be locked.</para>
</refsect3></refsect2>
<refsect2 id="g-static-rec-mutex-unlock" role="function" condition="deprecated:2.32: Use g_rec_mutex_unlock()">
<title>g_static_rec_mutex_unlock&#160;()</title>
<indexterm zone="g-static-rec-mutex-unlock" role="deprecated"><primary sortas="static_rec_mutex_unlock">g_static_rec_mutex_unlock</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_rec_mutex_unlock (<parameter><link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> *mutex</parameter>);</programlisting>
<warning><para><literal>g_static_rec_mutex_unlock</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-rec-mutex-unlock"><function>g_rec_mutex_unlock()</function></link></para>
</warning>
<para>Unlocks <parameter>mutex</parameter>
. Another thread will be allowed to lock <parameter>mutex</parameter>
 only
when it has been unlocked as many times as it had been locked
before. If <parameter>mutex</parameter>
 is completely unlocked and another thread is
blocked in a <link linkend="g-static-rec-mutex-lock"><function>g_static_rec_mutex_lock()</function></link> call for <parameter>mutex</parameter>
, it will be
woken and can lock <parameter>mutex</parameter>
 itself.</para>
<refsect3 id="g-static-rec-mutex-unlock.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>mutex</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> to unlock.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-static-rec-mutex-lock-full" role="function" condition="deprecated:2.32: Use g_rec_mutex_lock()">
<title>g_static_rec_mutex_lock_full&#160;()</title>
<indexterm zone="g-static-rec-mutex-lock-full" role="deprecated"><primary sortas="static_rec_mutex_lock_full">g_static_rec_mutex_lock_full</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_rec_mutex_lock_full (<parameter><link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> *mutex</parameter>,
                              <parameter><link linkend="guint"><type>guint</type></link> depth</parameter>);</programlisting>
<warning><para><literal>g_static_rec_mutex_lock_full</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-rec-mutex-lock"><function>g_rec_mutex_lock()</function></link></para>
</warning>
<para>Works like calling <link linkend="g-static-rec-mutex-lock"><function>g_static_rec_mutex_lock()</function></link> for <parameter>mutex</parameter>
 <parameter>depth</parameter>
 times.</para>
<refsect3 id="g-static-rec-mutex-lock-full.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>mutex</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> to lock.</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>depth</para></entry>
<entry role="parameter_description"><para>number of times this mutex has to be unlocked to be
completely unlocked.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-static-rec-mutex-unlock-full" role="function" condition="deprecated:2.32: Use g_rec_mutex_unlock()">
<title>g_static_rec_mutex_unlock_full&#160;()</title>
<indexterm zone="g-static-rec-mutex-unlock-full" role="deprecated"><primary sortas="static_rec_mutex_unlock_full">g_static_rec_mutex_unlock_full</primary></indexterm>
<programlisting language="C"><link linkend="guint"><returnvalue>guint</returnvalue></link>
g_static_rec_mutex_unlock_full (<parameter><link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> *mutex</parameter>);</programlisting>
<warning><para><literal>g_static_rec_mutex_unlock_full</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-rec-mutex-unlock"><function>g_rec_mutex_unlock()</function></link></para>
</warning>
<para>Completely unlocks <parameter>mutex</parameter>
. If another thread is blocked in a
<link linkend="g-static-rec-mutex-lock"><function>g_static_rec_mutex_lock()</function></link> call for <parameter>mutex</parameter>
, it will be woken and can
lock <parameter>mutex</parameter>
 itself. This function returns the number of times that
<parameter>mutex</parameter>
 has been locked by the current thread. To restore the state
before the call to <link linkend="g-static-rec-mutex-unlock-full"><function>g_static_rec_mutex_unlock_full()</function></link> you can call
<link linkend="g-static-rec-mutex-lock-full"><function>g_static_rec_mutex_lock_full()</function></link> with the depth returned by this
function.</para>
<refsect3 id="g-static-rec-mutex-unlock-full.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>mutex</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> to completely unlock.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-static-rec-mutex-unlock-full.returns" role="returns">
<title>Returns</title>
<para> number of times <parameter>mutex</parameter>
has been locked by the current
thread.</para>
</refsect3></refsect2>
<refsect2 id="g-static-rec-mutex-free" role="function" condition="deprecated:2.32: Use g_rec_mutex_clear()">
<title>g_static_rec_mutex_free&#160;()</title>
<indexterm zone="g-static-rec-mutex-free" role="deprecated"><primary sortas="static_rec_mutex_free">g_static_rec_mutex_free</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_rec_mutex_free (<parameter><link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> *mutex</parameter>);</programlisting>
<warning><para><literal>g_static_rec_mutex_free</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-rec-mutex-clear"><function>g_rec_mutex_clear()</function></link></para>
</warning>
<para>Releases all resources allocated to a <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link>.</para>
<para>You don't have to call this functions for a <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> with an
unbounded lifetime, i.e. objects declared 'static', but if you have
a <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> as a member of a structure and the structure is
freed, you should also free the <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link>.</para>
<refsect3 id="g-static-rec-mutex-free.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>mutex</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> to be freed.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-static-rw-lock-init" role="function" condition="deprecated:2.32: Use g_rw_lock_init() instead">
<title>g_static_rw_lock_init&#160;()</title>
<indexterm zone="g-static-rw-lock-init" role="deprecated"><primary sortas="static_rw_lock_init">g_static_rw_lock_init</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_rw_lock_init (<parameter><link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> *lock</parameter>);</programlisting>
<warning><para><literal>g_static_rw_lock_init</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-rw-lock-init"><function>g_rw_lock_init()</function></link> instead</para>
</warning>
<para>A <link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> must be initialized with this function before it
can be used. Alternatively you can initialize it with
<link linkend="G-STATIC-RW-LOCK-INIT:CAPS"><type>G_STATIC_RW_LOCK_INIT</type></link>.</para>
<refsect3 id="g-static-rw-lock-init.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>lock</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> to be initialized.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-static-rw-lock-reader-lock" role="function" condition="deprecated:2.32: Use g_rw_lock_reader_lock() instead">
<title>g_static_rw_lock_reader_lock&#160;()</title>
<indexterm zone="g-static-rw-lock-reader-lock" role="deprecated"><primary sortas="static_rw_lock_reader_lock">g_static_rw_lock_reader_lock</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_rw_lock_reader_lock (<parameter><link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> *lock</parameter>);</programlisting>
<warning><para><literal>g_static_rw_lock_reader_lock</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-rw-lock-reader-lock"><function>g_rw_lock_reader_lock()</function></link> instead</para>
</warning>
<para>Locks <parameter>lock</parameter>
 for reading. There may be unlimited concurrent locks for
reading of a <link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> at the same time.  If <parameter>lock</parameter>
 is already
locked for writing by another thread or if another thread is already
waiting to lock <parameter>lock</parameter>
 for writing, this function will block until
<parameter>lock</parameter>
 is unlocked by the other writing thread and no other writing
threads want to lock <parameter>lock</parameter>
. This lock has to be unlocked by
<link linkend="g-static-rw-lock-reader-unlock"><function>g_static_rw_lock_reader_unlock()</function></link>.</para>
<para><link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> is not recursive. It might seem to be possible to
recursively lock for reading, but that can result in a deadlock, due
to writer preference.</para>
<refsect3 id="g-static-rw-lock-reader-lock.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>lock</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> to lock for reading.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-static-rw-lock-reader-trylock" role="function" condition="deprecated:2.32: Use g_rw_lock_reader_trylock() instead">
<title>g_static_rw_lock_reader_trylock&#160;()</title>
<indexterm zone="g-static-rw-lock-reader-trylock" role="deprecated"><primary sortas="static_rw_lock_reader_trylock">g_static_rw_lock_reader_trylock</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_static_rw_lock_reader_trylock (<parameter><link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> *lock</parameter>);</programlisting>
<warning><para><literal>g_static_rw_lock_reader_trylock</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-rw-lock-reader-trylock"><function>g_rw_lock_reader_trylock()</function></link> instead</para>
</warning>
<para>Tries to lock <parameter>lock</parameter>
 for reading. If <parameter>lock</parameter>
 is already locked for
writing by another thread or if another thread is already waiting to
lock <parameter>lock</parameter>
 for writing, immediately returns <link linkend="FALSE:CAPS"><literal>FALSE</literal></link>. Otherwise locks
<parameter>lock</parameter>
 for reading and returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>. This lock has to be unlocked by
<link linkend="g-static-rw-lock-reader-unlock"><function>g_static_rw_lock_reader_unlock()</function></link>.</para>
<refsect3 id="g-static-rw-lock-reader-trylock.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>lock</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> to lock for reading</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-static-rw-lock-reader-trylock.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, if <parameter>lock</parameter>
could be locked for reading</para>
</refsect3></refsect2>
<refsect2 id="g-static-rw-lock-reader-unlock" role="function" condition="deprecated:2.32: Use g_rw_lock_reader_unlock() instead">
<title>g_static_rw_lock_reader_unlock&#160;()</title>
<indexterm zone="g-static-rw-lock-reader-unlock" role="deprecated"><primary sortas="static_rw_lock_reader_unlock">g_static_rw_lock_reader_unlock</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_rw_lock_reader_unlock (<parameter><link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> *lock</parameter>);</programlisting>
<warning><para><literal>g_static_rw_lock_reader_unlock</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-rw-lock-reader-unlock"><function>g_rw_lock_reader_unlock()</function></link> instead</para>
</warning>
<para>Unlocks <parameter>lock</parameter>
. If a thread waits to lock <parameter>lock</parameter>
 for writing and all
locks for reading have been unlocked, the waiting thread is woken up
and can lock <parameter>lock</parameter>
 for writing.</para>
<refsect3 id="g-static-rw-lock-reader-unlock.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>lock</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> to unlock after reading</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-static-rw-lock-writer-lock" role="function" condition="deprecated:2.32: Use g_rw_lock_writer_lock() instead">
<title>g_static_rw_lock_writer_lock&#160;()</title>
<indexterm zone="g-static-rw-lock-writer-lock" role="deprecated"><primary sortas="static_rw_lock_writer_lock">g_static_rw_lock_writer_lock</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_rw_lock_writer_lock (<parameter><link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> *lock</parameter>);</programlisting>
<warning><para><literal>g_static_rw_lock_writer_lock</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-rw-lock-writer-lock"><function>g_rw_lock_writer_lock()</function></link> instead</para>
</warning>
<para>Locks <parameter>lock</parameter>
 for writing. If <parameter>lock</parameter>
 is already locked for writing or
reading by other threads, this function will block until <parameter>lock</parameter>
 is
completely unlocked and then lock <parameter>lock</parameter>
 for writing. While this
functions waits to lock <parameter>lock</parameter>
, no other thread can lock <parameter>lock</parameter>
 for
reading. When <parameter>lock</parameter>
 is locked for writing, no other thread can lock
<parameter>lock</parameter>
 (neither for reading nor writing). This lock has to be
unlocked by <link linkend="g-static-rw-lock-writer-unlock"><function>g_static_rw_lock_writer_unlock()</function></link>.</para>
<refsect3 id="g-static-rw-lock-writer-lock.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>lock</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> to lock for writing</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-static-rw-lock-writer-trylock" role="function" condition="deprecated:2.32: Use g_rw_lock_writer_trylock() instead">
<title>g_static_rw_lock_writer_trylock&#160;()</title>
<indexterm zone="g-static-rw-lock-writer-trylock" role="deprecated"><primary sortas="static_rw_lock_writer_trylock">g_static_rw_lock_writer_trylock</primary></indexterm>
<programlisting language="C"><link linkend="gboolean"><returnvalue>gboolean</returnvalue></link>
g_static_rw_lock_writer_trylock (<parameter><link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> *lock</parameter>);</programlisting>
<warning><para><literal>g_static_rw_lock_writer_trylock</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-rw-lock-writer-trylock"><function>g_rw_lock_writer_trylock()</function></link> instead</para>
</warning>
<para>Tries to lock <parameter>lock</parameter>
 for writing. If <parameter>lock</parameter>
 is already locked (for
either reading or writing) by another thread, it immediately returns
<link linkend="FALSE:CAPS"><literal>FALSE</literal></link>. Otherwise it locks <parameter>lock</parameter>
 for writing and returns <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>. This
lock has to be unlocked by <link linkend="g-static-rw-lock-writer-unlock"><function>g_static_rw_lock_writer_unlock()</function></link>.</para>
<refsect3 id="g-static-rw-lock-writer-trylock.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>lock</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> to lock for writing</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-static-rw-lock-writer-trylock.returns" role="returns">
<title>Returns</title>
<para> <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>, if <parameter>lock</parameter>
could be locked for writing</para>
</refsect3></refsect2>
<refsect2 id="g-static-rw-lock-writer-unlock" role="function" condition="deprecated:2.32: Use g_rw_lock_writer_unlock() instead">
<title>g_static_rw_lock_writer_unlock&#160;()</title>
<indexterm zone="g-static-rw-lock-writer-unlock" role="deprecated"><primary sortas="static_rw_lock_writer_unlock">g_static_rw_lock_writer_unlock</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_rw_lock_writer_unlock (<parameter><link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> *lock</parameter>);</programlisting>
<warning><para><literal>g_static_rw_lock_writer_unlock</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use <link linkend="g-rw-lock-writer-unlock"><function>g_rw_lock_writer_unlock()</function></link> instead</para>
</warning>
<para>Unlocks <parameter>lock</parameter>
. If a thread is waiting to lock <parameter>lock</parameter>
 for writing and
all locks for reading have been unlocked, the waiting thread is
woken up and can lock <parameter>lock</parameter>
 for writing. If no thread is waiting to
lock <parameter>lock</parameter>
 for writing, and some thread or threads are waiting to
lock <parameter>lock</parameter>
 for reading, the waiting threads are woken up and can
lock <parameter>lock</parameter>
 for reading.</para>
<refsect3 id="g-static-rw-lock-writer-unlock.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>lock</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> to unlock after writing.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-static-rw-lock-free" role="function" condition="deprecated:2.32: Use a #GRWLock instead">
<title>g_static_rw_lock_free&#160;()</title>
<indexterm zone="g-static-rw-lock-free" role="deprecated"><primary sortas="static_rw_lock_free">g_static_rw_lock_free</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_rw_lock_free (<parameter><link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> *lock</parameter>);</programlisting>
<warning><para><literal>g_static_rw_lock_free</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use a <link linkend="GRWLock"><type>GRWLock</type></link> instead</para>
</warning>
<para>Releases all resources allocated to <parameter>lock</parameter>
.</para>
<para>You don't have to call this functions for a <link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> with an
unbounded lifetime, i.e. objects declared 'static', but if you have
a <link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> as a member of a structure, and the structure is
freed, you should also free the <link linkend="GStaticRWLock"><type>GStaticRWLock</type></link>.</para>
<refsect3 id="g-static-rw-lock-free.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>lock</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> to be freed.</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-static-private-init" role="function" condition="deprecated:">
<title>g_static_private_init&#160;()</title>
<indexterm zone="g-static-private-init" role="deprecated"><primary sortas="static_private_init">g_static_private_init</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_private_init (<parameter><link linkend="GStaticPrivate"><type>GStaticPrivate</type></link> *private_key</parameter>);</programlisting>
<warning><para><literal>g_static_private_init</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>Initializes <parameter>private_key</parameter>
. Alternatively you can initialize it with
<link linkend="G-STATIC-PRIVATE-INIT:CAPS"><type>G_STATIC_PRIVATE_INIT</type></link>.</para>
<refsect3 id="g-static-private-init.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>private_key</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticPrivate"><type>GStaticPrivate</type></link> to be initialized</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-static-private-get" role="function" condition="deprecated:">
<title>g_static_private_get&#160;()</title>
<indexterm zone="g-static-private-get" role="deprecated"><primary sortas="static_private_get">g_static_private_get</primary></indexterm>
<programlisting language="C"><link linkend="gpointer"><returnvalue>gpointer</returnvalue></link>
g_static_private_get (<parameter><link linkend="GStaticPrivate"><type>GStaticPrivate</type></link> *private_key</parameter>);</programlisting>
<warning><para><literal>g_static_private_get</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>Works like <link linkend="g-private-get"><function>g_private_get()</function></link> only for a <link linkend="GStaticPrivate"><type>GStaticPrivate</type></link>.</para>
<para>This function works even if <link linkend="g-thread-init"><function>g_thread_init()</function></link> has not yet been called.</para>
<refsect3 id="g-static-private-get.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>private_key</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticPrivate"><type>GStaticPrivate</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3><refsect3 id="g-static-private-get.returns" role="returns">
<title>Returns</title>
<para> the corresponding pointer</para>
</refsect3></refsect2>
<refsect2 id="g-static-private-set" role="function" condition="deprecated:">
<title>g_static_private_set&#160;()</title>
<indexterm zone="g-static-private-set" role="deprecated"><primary sortas="static_private_set">g_static_private_set</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_private_set (<parameter><link linkend="GStaticPrivate"><type>GStaticPrivate</type></link> *private_key</parameter>,
                      <parameter><link linkend="gpointer"><type>gpointer</type></link> data</parameter>,
                      <parameter><link linkend="GDestroyNotify"><type>GDestroyNotify</type></link> notify</parameter>);</programlisting>
<warning><para><literal>g_static_private_set</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>Sets the pointer keyed to <parameter>private_key</parameter>
 for the current thread and
the function <parameter>notify</parameter>
 to be called with that pointer (<link linkend="NULL:CAPS"><literal>NULL</literal></link> or
non-<link linkend="NULL:CAPS"><literal>NULL</literal></link>), whenever the pointer is set again or whenever the
current thread ends.</para>
<para>This function works even if <link linkend="g-thread-init"><function>g_thread_init()</function></link> has not yet been called.
If <link linkend="g-thread-init"><function>g_thread_init()</function></link> is called later, the <parameter>data</parameter>
 keyed to <parameter>private_key</parameter>

will be inherited only by the main thread, i.e. the one that called
<link linkend="g-thread-init"><function>g_thread_init()</function></link>.</para>
<para><parameter>notify</parameter>
 is used quite differently from <parameter>destructor</parameter>
 in <link linkend="g-private-new"><function>g_private_new()</function></link>.</para>
<refsect3 id="g-static-private-set.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>private_key</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticPrivate"><type>GStaticPrivate</type></link></para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>data</para></entry>
<entry role="parameter_description"><para>the new pointer</para></entry>
<entry role="parameter_annotations"></entry></row>
<row><entry role="parameter_name"><para>notify</para></entry>
<entry role="parameter_description"><para>a function to be called with the pointer whenever the
current thread ends or sets this pointer again</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="g-static-private-free" role="function" condition="deprecated:">
<title>g_static_private_free&#160;()</title>
<indexterm zone="g-static-private-free" role="deprecated"><primary sortas="static_private_free">g_static_private_free</primary></indexterm>
<programlisting language="C"><link linkend="void"><returnvalue>void</returnvalue></link>
g_static_private_free (<parameter><link linkend="GStaticPrivate"><type>GStaticPrivate</type></link> *private_key</parameter>);</programlisting>
<warning><para><literal>g_static_private_free</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>Releases all resources allocated to <parameter>private_key</parameter>
.</para>
<para>You don't have to call this functions for a <link linkend="GStaticPrivate"><type>GStaticPrivate</type></link> with an
unbounded lifetime, i.e. objects declared 'static', but if you have
a <link linkend="GStaticPrivate"><type>GStaticPrivate</type></link> as a member of a structure and the structure is
freed, you should also free the <link linkend="GStaticPrivate"><type>GStaticPrivate</type></link>.</para>
<refsect3 id="g-static-private-free.parameters" role="parameters">
<title>Parameters</title>
<informaltable role="parameters_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="parameters_name" colwidth="150px"/>
<colspec colname="parameters_description"/>
<colspec colname="parameters_annotations" colwidth="200px"/>
<tbody>
<row><entry role="parameter_name"><para>private_key</para></entry>
<entry role="parameter_description"><para>a <link linkend="GStaticPrivate"><type>GStaticPrivate</type></link> to be freed</para></entry>
<entry role="parameter_annotations"></entry></row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>

</refsect1>
<refsect1 id="glib-Deprecated-Thread-APIs.other_details" role="details">
<title role="details.title">Types and Values</title>
<refsect2 id="G-THREADS-IMPL-POSIX:CAPS" role="macro" condition="deprecated">
<title>G_THREADS_IMPL_POSIX</title>
<indexterm zone="G-THREADS-IMPL-POSIX:CAPS" role="deprecated"><primary sortas="THREADS_IMPL_POSIX">G_THREADS_IMPL_POSIX</primary></indexterm>
<programlisting language="C">#define G_THREADS_IMPL_POSIX
</programlisting>
<warning><para><literal>G_THREADS_IMPL_POSIX</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>POSIX threads are in use on all non-Windows systems.
                Use G_OS_WIN32 to detect Windows.</para>
</warning>
<para>This macro is defined if POSIX style threads are used.</para>
</refsect2>
<refsect2 id="G-THREADS-IMPL-WIN32:CAPS" role="macro" condition="deprecated:2.32:Use G_OS_WIN32 to detect Windows.">
<title>G_THREADS_IMPL_WIN32</title>
<indexterm zone="G-THREADS-IMPL-WIN32:CAPS" role="deprecated"><primary sortas="THREADS_IMPL_WIN32">G_THREADS_IMPL_WIN32</primary></indexterm>
<programlisting language="C">#define G_THREADS_IMPL_NONE
</programlisting>
<warning><para><literal>G_THREADS_IMPL_WIN32</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use G_OS_WIN32 to detect Windows.</para>
</warning>
<para>This macro is defined if Windows style threads are used.</para>
</refsect2>
<refsect2 id="GThreadPriority" role="enum" condition="deprecated:2.32: Thread priorities no longer have any effect.">
<title>enum GThreadPriority</title>
<indexterm zone="GThreadPriority" role="deprecated"><primary sortas="ThreadPriority">GThreadPriority</primary></indexterm>
<warning><para><literal>GThreadPriority</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Thread priorities no longer have any effect.</para>
</warning>
<para>Thread priorities.</para>
<refsect3 id="GThreadPriority.members" role="enum_members">
<title>Members</title>
<informaltable role="enum_members_table" pgwide="1" frame="none">
<tgroup cols="3">
<colspec colname="enum_members_name" colwidth="300px"/>
<colspec colname="enum_members_description"/>
<colspec colname="enum_members_annotations" colwidth="200px"/>
<tbody>
<row role="constant"><entry role="enum_member_name"><para id="G-THREAD-PRIORITY-LOW:CAPS">G_THREAD_PRIORITY_LOW</para></entry>
<entry role="enum_member_description"><para>a priority lower than normal</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-THREAD-PRIORITY-NORMAL:CAPS">G_THREAD_PRIORITY_NORMAL</para></entry>
<entry role="enum_member_description"><para>the default priority</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-THREAD-PRIORITY-HIGH:CAPS">G_THREAD_PRIORITY_HIGH</para></entry>
<entry role="enum_member_description"><para>a priority higher than normal</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
<row role="constant"><entry role="enum_member_name"><para id="G-THREAD-PRIORITY-URGENT:CAPS">G_THREAD_PRIORITY_URGENT</para></entry>
<entry role="enum_member_description"><para>the highest priority</para>
</entry>
<entry role="enum_member_annotations"></entry>
</row>
</tbody></tgroup></informaltable>
</refsect3></refsect2>
<refsect2 id="GStaticMutex" role="struct">
<title>GStaticMutex</title>
<indexterm zone="GStaticMutex"><primary sortas="StaticMutex">GStaticMutex</primary></indexterm>
<programlisting language="C">typedef struct _GStaticMutex GStaticMutex;</programlisting>
<para>A <link linkend="GStaticMutex"><type>GStaticMutex</type></link> works like a <link linkend="GMutex"><type>GMutex</type></link>.</para>
<para>Prior to GLib 2.32, GStaticMutex had the significant advantage
that it doesn't need to be created at run-time, but can be defined
at compile-time. Since 2.32, <link linkend="GMutex"><type>GMutex</type></link> can be statically allocated
as well, and GStaticMutex has been deprecated.</para>
<para>Here is a version of our <link linkend="give-me-next-number"><function>give_me_next_number()</function></link> example using
a GStaticMutex:</para>
<informalexample><programlisting role="example"><![CDATA[
  int
  give_me_next_number (void)
  {
    static int current_number = 0;
    int ret_val;
    static GStaticMutex mutex = G_STATIC_MUTEX_INIT;

    g_static_mutex_lock (&mutex);
    ret_val = current_number = calc_next_number (current_number);
    g_static_mutex_unlock (&mutex);

    return ret_val;
  }
]]></programlisting></informalexample>
<para></para>
<para>Sometimes you would like to dynamically create a mutex. If you don't
want to require prior calling to <link linkend="g-thread-init"><function>g_thread_init()</function></link>, because your code
should also be usable in non-threaded programs, you are not able to
use <link linkend="g-mutex-new"><function>g_mutex_new()</function></link> and thus <link linkend="GMutex"><type>GMutex</type></link>, as that requires a prior call to
<link linkend="g-thread-init"><function>g_thread_init()</function></link>. In these cases you can also use a <link linkend="GStaticMutex"><type>GStaticMutex</type></link>.
It must be initialized with <link linkend="g-static-mutex-init"><function>g_static_mutex_init()</function></link> before using it
and freed with with <link linkend="g-static-mutex-free"><function>g_static_mutex_free()</function></link> when not needed anymore to
free up any allocated resources.</para>
<para>Even though <link linkend="GStaticMutex"><type>GStaticMutex</type></link> is not opaque, it should only be used with
the following functions, as it is defined differently on different
platforms.</para>
<para>All of the g_static_mutex_* functions apart from
<link linkend="g-static-mutex-get-mutex"><function>g_static_mutex_get_mutex()</function></link> can also be used even if <link linkend="g-thread-init"><function>g_thread_init()</function></link>
has not yet been called. Then they do nothing, apart from
<link linkend="g-static-mutex-trylock"><function>g_static_mutex_trylock()</function></link> which does nothing but returning <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>.</para>
<para>All of the g_static_mutex_* functions are actually macros. Apart from
taking their addresses, you can however use them as if they were
functions.</para>
</refsect2>
<refsect2 id="G-STATIC-MUTEX-INIT:CAPS" role="macro">
<title>G_STATIC_MUTEX_INIT</title>
<indexterm zone="G-STATIC-MUTEX-INIT:CAPS"><primary sortas="STATIC_MUTEX_INIT">G_STATIC_MUTEX_INIT</primary></indexterm>
<programlisting language="C">#define G_STATIC_MUTEX_INIT
</programlisting>
<para>A <link linkend="GStaticMutex"><type>GStaticMutex</type></link> must be initialized with this macro, before it can
be used. This macro can used be to initialize a variable, but it
cannot be assigned to a variable. In that case you have to use
<link linkend="g-static-mutex-init"><function>g_static_mutex_init()</function></link>.</para>
<informalexample><programlisting role="example"><![CDATA[
GStaticMutex my_mutex = G_STATIC_MUTEX_INIT;
]]></programlisting></informalexample>
<para></para>
</refsect2>
<refsect2 id="GStaticRecMutex" role="struct" condition="deprecated:">
<title>struct GStaticRecMutex</title>
<indexterm zone="GStaticRecMutex" role="deprecated"><primary sortas="StaticRecMutex">GStaticRecMutex</primary></indexterm>
<programlisting language="C">struct GStaticRecMutex {
};
</programlisting>
<warning><para><literal>GStaticRecMutex</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>A <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> works like a <link linkend="GStaticMutex"><type>GStaticMutex</type></link>, but it can be locked
multiple times by one thread. If you enter it n times, you have to
unlock it n times again to let other threads lock it. An exception
is the function <link linkend="g-static-rec-mutex-unlock-full"><function>g_static_rec_mutex_unlock_full()</function></link>: that allows you to
unlock a <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> completely returning the depth, (i.e. the
number of times this mutex was locked). The depth can later be used
to restore the state of the <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> by calling
<link linkend="g-static-rec-mutex-lock-full"><function>g_static_rec_mutex_lock_full()</function></link>. In GLib 2.32, <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> has
been deprecated in favor of <link linkend="GRecMutex"><type>GRecMutex</type></link>.</para>
<para>Even though <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> is not opaque, it should only be used
with the following functions.</para>
<para>All of the g_static_rec_mutex_* functions can be used even if
<link linkend="g-thread-init"><function>g_thread_init()</function></link> has not been called. Then they do nothing, apart
from <link linkend="g-static-rec-mutex-trylock"><function>g_static_rec_mutex_trylock()</function></link>, which does nothing but returning
<link linkend="TRUE:CAPS"><literal>TRUE</literal></link>.</para>
</refsect2>
<refsect2 id="G-STATIC-REC-MUTEX-INIT:CAPS" role="macro">
<title>G_STATIC_REC_MUTEX_INIT</title>
<indexterm zone="G-STATIC-REC-MUTEX-INIT:CAPS"><primary sortas="STATIC_REC_MUTEX_INIT">G_STATIC_REC_MUTEX_INIT</primary></indexterm>
<programlisting language="C">#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT, 0, { 0 } } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_rec_mutex_init)
</programlisting>
<para>A <link linkend="GStaticRecMutex"><type>GStaticRecMutex</type></link> must be initialized with this macro before it can
be used. This macro can used be to initialize a variable, but it
cannot be assigned to a variable. In that case you have to use
<link linkend="g-static-rec-mutex-init"><function>g_static_rec_mutex_init()</function></link>.</para>
<informalexample><programlisting role="example"><![CDATA[
  GStaticRecMutex my_mutex = G_STATIC_REC_MUTEX_INIT;
]]></programlisting></informalexample>
<para></para>
</refsect2>
<refsect2 id="GStaticRWLock" role="struct" condition="deprecated:2.32: Use a #GRWLock instead">
<title>struct GStaticRWLock</title>
<indexterm zone="GStaticRWLock" role="deprecated"><primary sortas="StaticRWLock">GStaticRWLock</primary></indexterm>
<programlisting language="C">struct GStaticRWLock {
};
</programlisting>
<warning><para><literal>GStaticRWLock</literal> has been deprecated since version 2.32 and should not be used in newly-written code.</para> <para>Use a <link linkend="GRWLock"><type>GRWLock</type></link> instead</para>
</warning>
<para>The <link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> struct represents a read-write lock. A read-write
lock can be used for protecting data that some portions of code only
read from, while others also write. In such situations it is
desirable that several readers can read at once, whereas of course
only one writer may write at a time.</para>
<para>Take a look at the following example:</para>
<informalexample><programlisting role="example"><![CDATA[
  GStaticRWLock rwlock = G_STATIC_RW_LOCK_INIT;
  GPtrArray *array;

  gpointer
  my_array_get (guint index)
  {
    gpointer retval = NULL;

    if (!array)
      return NULL;

    g_static_rw_lock_reader_lock (&rwlock);
    if (index < array->len)
      retval = g_ptr_array_index (array, index);
    g_static_rw_lock_reader_unlock (&rwlock);

    return retval;
  }

  void
  my_array_set (guint index, gpointer data)
  {
    g_static_rw_lock_writer_lock (&rwlock);

    if (!array)
      array = g_ptr_array_new ();

    if (index >= array->len)
      g_ptr_array_set_size (array, index + 1);
    g_ptr_array_index (array, index) = data;

    g_static_rw_lock_writer_unlock (&rwlock);
  }
]]></programlisting></informalexample>
<para></para>
<para>This example shows an array which can be accessed by many readers
(the <link linkend="my-array-get"><function>my_array_get()</function></link> function) simultaneously, whereas the writers
(the <link linkend="my-array-set"><function>my_array_set()</function></link> function) will only be allowed once at a time
and only if no readers currently access the array. This is because
of the potentially dangerous resizing of the array. Using these
functions is fully multi-thread safe now.</para>
<para>Most of the time, writers should have precedence over readers. That
means, for this implementation, that as soon as a writer wants to
lock the data, no other reader is allowed to lock the data, whereas,
of course, the readers that already have locked the data are allowed
to finish their operation. As soon as the last reader unlocks the
data, the writer will lock it.</para>
<para>Even though <link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> is not opaque, it should only be used
with the following functions.</para>
<para>All of the g_static_rw_lock_* functions can be used even if
<link linkend="g-thread-init"><function>g_thread_init()</function></link> has not been called. Then they do nothing, apart
from g_static_rw_lock_*_trylock, which does nothing but returning <link linkend="TRUE:CAPS"><literal>TRUE</literal></link>.</para>
<para>A read-write lock has a higher overhead than a mutex. For example, both
<link linkend="g-static-rw-lock-reader-lock"><function>g_static_rw_lock_reader_lock()</function></link> and <link linkend="g-static-rw-lock-reader-unlock"><function>g_static_rw_lock_reader_unlock()</function></link> have
to lock and unlock a <link linkend="GStaticMutex"><type>GStaticMutex</type></link>, so it takes at least twice the time
to lock and unlock a <link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> that it does to lock and unlock a
<link linkend="GStaticMutex"><type>GStaticMutex</type></link>. So only data structures that are accessed by multiple
readers, and which keep the lock for a considerable time justify a
<link linkend="GStaticRWLock"><type>GStaticRWLock</type></link>. The above example most probably would fare better with a
<link linkend="GStaticMutex"><type>GStaticMutex</type></link>.</para>
</refsect2>
<refsect2 id="G-STATIC-RW-LOCK-INIT:CAPS" role="macro">
<title>G_STATIC_RW_LOCK_INIT</title>
<indexterm zone="G-STATIC-RW-LOCK-INIT:CAPS"><primary sortas="STATIC_RW_LOCK_INIT">G_STATIC_RW_LOCK_INIT</primary></indexterm>
<programlisting language="C">#define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, 0, 0 } GLIB_DEPRECATED_MACRO_IN_2_32_FOR(g_rw_lock_init)
</programlisting>
<para>A <link linkend="GStaticRWLock"><type>GStaticRWLock</type></link> must be initialized with this macro before it can
be used. This macro can used be to initialize a variable, but it
cannot be assigned to a variable. In that case you have to use
<link linkend="g-static-rw-lock-init"><function>g_static_rw_lock_init()</function></link>.</para>
<informalexample><programlisting role="example"><![CDATA[
  GStaticRWLock my_lock = G_STATIC_RW_LOCK_INIT;
]]></programlisting></informalexample>
<para></para>
</refsect2>
<refsect2 id="GStaticPrivate" role="struct" condition="deprecated:">
<title>struct GStaticPrivate</title>
<indexterm zone="GStaticPrivate" role="deprecated"><primary sortas="StaticPrivate">GStaticPrivate</primary></indexterm>
<programlisting language="C">struct GStaticPrivate {
};
</programlisting>
<warning><para><literal>GStaticPrivate</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>A <link linkend="GStaticPrivate"><type>GStaticPrivate</type></link> works almost like a <link linkend="GPrivate"><type>GPrivate</type></link>, but it has one
significant advantage. It doesn't need to be created at run-time
like a <link linkend="GPrivate"><type>GPrivate</type></link>, but can be defined at compile-time. This is
similar to the difference between <link linkend="GMutex"><type>GMutex</type></link> and <link linkend="GStaticMutex"><type>GStaticMutex</type></link>.</para>
<para>Now look at our <link linkend="give-me-next-number"><function>give_me_next_number()</function></link> example with <link linkend="GStaticPrivate"><type>GStaticPrivate</type></link>:</para>
<informalexample><programlisting role="example"><![CDATA[
  int
  give_me_next_number ()
  {
    static GStaticPrivate current_number_key = G_STATIC_PRIVATE_INIT;
    int *current_number = g_static_private_get (&current_number_key);

    if (!current_number)
      {
        current_number = g_new (int, 1);
        *current_number = 0;
        g_static_private_set (&current_number_key, current_number, g_free);
      }

    *current_number = calc_next_number (*current_number);

    return *current_number;
  }
]]></programlisting></informalexample>
<para></para>
</refsect2>
<refsect2 id="G-STATIC-PRIVATE-INIT:CAPS" role="macro">
<title>G_STATIC_PRIVATE_INIT</title>
<indexterm zone="G-STATIC-PRIVATE-INIT:CAPS"><primary sortas="STATIC_PRIVATE_INIT">G_STATIC_PRIVATE_INIT</primary></indexterm>
<programlisting language="C">#define G_STATIC_PRIVATE_INIT

</programlisting>
<para>Every <link linkend="GStaticPrivate"><type>GStaticPrivate</type></link> must be initialized with this macro, before it
can be used.</para>
<informalexample><programlisting role="example"><![CDATA[
  GStaticPrivate my_private = G_STATIC_PRIVATE_INIT;
]]></programlisting></informalexample>
<para></para>
</refsect2>

</refsect1>
<refsect1 id="glib-Deprecated-Thread-APIs.see-also">
<title>See Also</title>
<para><link linkend="GThread"><type>GThread</type></link></para>

</refsect1>

</refentry>
