1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <title>Deprecated thread API: GLib Reference Manual</title>
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="index.html" title="GLib Reference Manual">
8 <link rel="up" href="deprecated.html" title="Deprecated APIs">
9 <link rel="prev" href="deprecated.html" title="Deprecated APIs">
10 <link rel="next" href="glib-Caches.html" title="Caches">
11 <meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
12 <link rel="stylesheet" href="style.css" type="text/css">
14 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
15 <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
16 <td width="100%" align="left" class="shortcuts">
17 <a href="#" class="shortcut">Top</a><span id="nav_description"> <span class="dim">|</span>
18 <a href="#glib-Deprecated-Thread-APIs.description" class="shortcut">Description</a></span>
20 <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
21 <td><a accesskey="u" href="deprecated.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
22 <td><a accesskey="p" href="deprecated.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
23 <td><a accesskey="n" href="glib-Caches.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
25 <div class="refentry">
26 <a name="glib-Deprecated-Thread-APIs"></a><div class="titlepage"></div>
27 <div class="refnamediv"><table width="100%"><tr>
29 <h2><span class="refentrytitle"><a name="glib-Deprecated-Thread-APIs.top_of_page"></a>Deprecated thread API</span></h2>
30 <p>Deprecated thread API — old thread APIs (for reference only)</p>
32 <td class="gallery_image" valign="top" align="right"></td>
34 <div class="refsect1">
35 <a name="glib-Deprecated-Thread-APIs.functions"></a><h2>Functions</h2>
36 <div class="informaltable"><table class="informaltable" width="100%" border="0">
38 <col width="150px" class="functions_return">
39 <col class="functions_name">
43 <td class="function_type">
44 <span class="returnvalue">void</span>
46 <td class="function_name">
47 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()">g_thread_init</a> <span class="c_punctuation">()</span>
51 <td class="function_type">
52 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
54 <td class="function_name">
55 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-supported" title="g_thread_supported ()">g_thread_supported</a> <span class="c_punctuation">()</span>
59 <td class="function_type">
60 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
62 <td class="function_name">
63 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-get-initialized" title="g_thread_get_initialized ()">g_thread_get_initialized</a> <span class="c_punctuation">()</span>
67 <td class="function_type">
68 <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="returnvalue">GThread</span></a> *
70 <td class="function_name">
71 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-create" title="g_thread_create ()">g_thread_create</a> <span class="c_punctuation">()</span>
75 <td class="function_type">
76 <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="returnvalue">GThread</span></a> *
78 <td class="function_name">
79 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-create-full" title="g_thread_create_full ()">g_thread_create_full</a> <span class="c_punctuation">()</span>
83 <td class="function_type">
84 <span class="returnvalue">void</span>
86 <td class="function_name">
87 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-set-priority" title="g_thread_set_priority ()">g_thread_set_priority</a> <span class="c_punctuation">()</span>
91 <td class="function_type">
92 <span class="returnvalue">void</span>
94 <td class="function_name">
95 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-foreach" title="g_thread_foreach ()">g_thread_foreach</a> <span class="c_punctuation">()</span>
99 <td class="function_type">
100 <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="returnvalue">GMutex</span></a> *
102 <td class="function_name">
103 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-mutex-new" title="g_mutex_new ()">g_mutex_new</a> <span class="c_punctuation">()</span>
107 <td class="function_type">
108 <span class="returnvalue">void</span>
110 <td class="function_name">
111 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-mutex-free" title="g_mutex_free ()">g_mutex_free</a> <span class="c_punctuation">()</span>
115 <td class="function_type">
116 <a class="link" href="glib-Threads.html#GCond" title="struct GCond"><span class="returnvalue">GCond</span></a>*
118 <td class="function_name">
119 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-cond-new" title="g_cond_new ()">g_cond_new</a> <span class="c_punctuation">()</span>
123 <td class="function_type">
124 <span class="returnvalue">void</span>
126 <td class="function_name">
127 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-cond-free" title="g_cond_free ()">g_cond_free</a> <span class="c_punctuation">()</span>
131 <td class="function_type">
132 <a class="link" href="glib-Threads.html#GPrivate" title="struct GPrivate"><span class="returnvalue">GPrivate</span></a> *
134 <td class="function_name">
135 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-private-new" title="g_private_new ()">g_private_new</a> <span class="c_punctuation">()</span>
139 <td class="function_type">
140 <span class="returnvalue">void</span>
142 <td class="function_name">
143 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-init" title="g_static_mutex_init ()">g_static_mutex_init</a> <span class="c_punctuation">()</span>
147 <td class="function_type">
148 <span class="returnvalue">void</span>
150 <td class="function_name">
151 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-lock" title="g_static_mutex_lock ()">g_static_mutex_lock</a> <span class="c_punctuation">()</span>
155 <td class="function_type">
156 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
158 <td class="function_name">
159 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-trylock" title="g_static_mutex_trylock ()">g_static_mutex_trylock</a> <span class="c_punctuation">()</span>
163 <td class="function_type">
164 <span class="returnvalue">void</span>
166 <td class="function_name">
167 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-unlock" title="g_static_mutex_unlock ()">g_static_mutex_unlock</a> <span class="c_punctuation">()</span>
171 <td class="function_type">
172 <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="returnvalue">GMutex</span></a> *
174 <td class="function_name">
175 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-get-mutex" title="g_static_mutex_get_mutex ()">g_static_mutex_get_mutex</a> <span class="c_punctuation">()</span>
179 <td class="function_type">
180 <span class="returnvalue">void</span>
182 <td class="function_name">
183 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-free" title="g_static_mutex_free ()">g_static_mutex_free</a> <span class="c_punctuation">()</span>
187 <td class="function_type">
188 <span class="returnvalue">void</span>
190 <td class="function_name">
191 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-init" title="g_static_rec_mutex_init ()">g_static_rec_mutex_init</a> <span class="c_punctuation">()</span>
195 <td class="function_type">
196 <span class="returnvalue">void</span>
198 <td class="function_name">
199 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-lock" title="g_static_rec_mutex_lock ()">g_static_rec_mutex_lock</a> <span class="c_punctuation">()</span>
203 <td class="function_type">
204 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
206 <td class="function_name">
207 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-trylock" title="g_static_rec_mutex_trylock ()">g_static_rec_mutex_trylock</a> <span class="c_punctuation">()</span>
211 <td class="function_type">
212 <span class="returnvalue">void</span>
214 <td class="function_name">
215 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-unlock" title="g_static_rec_mutex_unlock ()">g_static_rec_mutex_unlock</a> <span class="c_punctuation">()</span>
219 <td class="function_type">
220 <span class="returnvalue">void</span>
222 <td class="function_name">
223 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-lock-full" title="g_static_rec_mutex_lock_full ()">g_static_rec_mutex_lock_full</a> <span class="c_punctuation">()</span>
227 <td class="function_type">
228 <a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="returnvalue">guint</span></a>
230 <td class="function_name">
231 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-unlock-full" title="g_static_rec_mutex_unlock_full ()">g_static_rec_mutex_unlock_full</a> <span class="c_punctuation">()</span>
235 <td class="function_type">
236 <span class="returnvalue">void</span>
238 <td class="function_name">
239 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-free" title="g_static_rec_mutex_free ()">g_static_rec_mutex_free</a> <span class="c_punctuation">()</span>
243 <td class="function_type">
244 <span class="returnvalue">void</span>
246 <td class="function_name">
247 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-init" title="g_static_rw_lock_init ()">g_static_rw_lock_init</a> <span class="c_punctuation">()</span>
251 <td class="function_type">
252 <span class="returnvalue">void</span>
254 <td class="function_name">
255 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-lock" title="g_static_rw_lock_reader_lock ()">g_static_rw_lock_reader_lock</a> <span class="c_punctuation">()</span>
259 <td class="function_type">
260 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
262 <td class="function_name">
263 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-trylock" title="g_static_rw_lock_reader_trylock ()">g_static_rw_lock_reader_trylock</a> <span class="c_punctuation">()</span>
267 <td class="function_type">
268 <span class="returnvalue">void</span>
270 <td class="function_name">
271 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-unlock" title="g_static_rw_lock_reader_unlock ()">g_static_rw_lock_reader_unlock</a> <span class="c_punctuation">()</span>
275 <td class="function_type">
276 <span class="returnvalue">void</span>
278 <td class="function_name">
279 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-writer-lock" title="g_static_rw_lock_writer_lock ()">g_static_rw_lock_writer_lock</a> <span class="c_punctuation">()</span>
283 <td class="function_type">
284 <a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
286 <td class="function_name">
287 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-writer-trylock" title="g_static_rw_lock_writer_trylock ()">g_static_rw_lock_writer_trylock</a> <span class="c_punctuation">()</span>
291 <td class="function_type">
292 <span class="returnvalue">void</span>
294 <td class="function_name">
295 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-writer-unlock" title="g_static_rw_lock_writer_unlock ()">g_static_rw_lock_writer_unlock</a> <span class="c_punctuation">()</span>
299 <td class="function_type">
300 <span class="returnvalue">void</span>
302 <td class="function_name">
303 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-free" title="g_static_rw_lock_free ()">g_static_rw_lock_free</a> <span class="c_punctuation">()</span>
307 <td class="function_type">
308 <span class="returnvalue">void</span>
310 <td class="function_name">
311 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-private-init" title="g_static_private_init ()">g_static_private_init</a> <span class="c_punctuation">()</span>
315 <td class="function_type">
316 <a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>
318 <td class="function_name">
319 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-private-get" title="g_static_private_get ()">g_static_private_get</a> <span class="c_punctuation">()</span>
323 <td class="function_type">
324 <span class="returnvalue">void</span>
326 <td class="function_name">
327 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-private-set" title="g_static_private_set ()">g_static_private_set</a> <span class="c_punctuation">()</span>
331 <td class="function_type">
332 <span class="returnvalue">void</span>
334 <td class="function_name">
335 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-private-free" title="g_static_private_free ()">g_static_private_free</a> <span class="c_punctuation">()</span>
341 <div class="refsect1">
342 <a name="glib-Deprecated-Thread-APIs.other"></a><h2>Types and Values</h2>
343 <div class="informaltable"><table class="informaltable" width="100%" border="0">
345 <col width="150px" class="name">
346 <col class="description">
350 <td class="define_keyword">#define</td>
351 <td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#G-THREADS-IMPL-POSIX:CAPS" title="G_THREADS_IMPL_POSIX">G_THREADS_IMPL_POSIX</a></td>
354 <td class="define_keyword">#define</td>
355 <td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#G-THREADS-IMPL-WIN32:CAPS" title="G_THREADS_IMPL_WIN32">G_THREADS_IMPL_WIN32</a></td>
358 <td class="datatype_keyword">enum</td>
359 <td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#GThreadPriority" title="enum GThreadPriority">GThreadPriority</a></td>
362 <td class="datatype_keyword"> </td>
363 <td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex">GStaticMutex</a></td>
366 <td class="define_keyword">#define</td>
367 <td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#G-STATIC-MUTEX-INIT:CAPS" title="G_STATIC_MUTEX_INIT">G_STATIC_MUTEX_INIT</a></td>
370 <td class="datatype_keyword">struct</td>
371 <td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex">GStaticRecMutex</a></td>
374 <td class="define_keyword">#define</td>
375 <td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#G-STATIC-REC-MUTEX-INIT:CAPS" title="G_STATIC_REC_MUTEX_INIT">G_STATIC_REC_MUTEX_INIT</a></td>
378 <td class="datatype_keyword">struct</td>
379 <td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock">GStaticRWLock</a></td>
382 <td class="define_keyword">#define</td>
383 <td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#G-STATIC-RW-LOCK-INIT:CAPS" title="G_STATIC_RW_LOCK_INIT">G_STATIC_RW_LOCK_INIT</a></td>
386 <td class="datatype_keyword">struct</td>
387 <td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate">GStaticPrivate</a></td>
390 <td class="define_keyword">#define</td>
391 <td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#G-STATIC-PRIVATE-INIT:CAPS" title="G_STATIC_PRIVATE_INIT">G_STATIC_PRIVATE_INIT</a></td>
396 <div class="refsect1">
397 <a name="glib-Deprecated-Thread-APIs.includes"></a><h2>Includes</h2>
398 <pre class="synopsis">#include <glib.h>
401 <div class="refsect1">
402 <a name="glib-Deprecated-Thread-APIs.description"></a><h2>Description</h2>
403 <p>These APIs are deprecated. You should not use them in new code.
404 This section remains only to assist with understanding code that was
405 written to use these APIs at some point in the past.</p>
407 <div class="refsect1">
408 <a name="glib-Deprecated-Thread-APIs.functions_details"></a><h2>Functions</h2>
409 <div class="refsect2">
410 <a name="g-thread-init"></a><h3>g_thread_init ()</h3>
411 <pre class="programlisting"><span class="returnvalue">void</span>
412 g_thread_init (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> vtable</code></em>);</pre>
413 <div class="warning">
414 <p><code class="literal">g_thread_init</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
415 <p>This function is no longer necessary. The GLib
416 threading system is automatically initialized at the start
419 <p>If you use GLib from more than one thread, you must initialize the
420 thread system by calling <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>.</p>
421 <p>Since version 2.24, calling <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> multiple times is allowed,
422 but nothing happens except for the first call.</p>
423 <p>Since version 2.32, GLib does not support custom thread implementations
424 anymore and the <em class="parameter"><code>vtable</code></em>
425 parameter is ignored and you should pass <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.</p>
426 <p><note><para><a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> must not be called directly or indirectly
427 in a callback from GLib. Also no mutexes may be currently locked while
428 calling <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>.</para></note></p>
429 <p><note><para>To use <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> in your program, you have to link
430 with the libraries that the command <command>pkg-config --libs
431 gthread-2.0</command> outputs. This is not the case for all the
432 other thread-related functions of GLib. Those can be used without
433 having to link with the thread libraries.</para></note></p>
434 <div class="refsect3">
435 <a name="g-thread-init.parameters"></a><h4>Parameters</h4>
436 <div class="informaltable"><table class="informaltable" width="100%" border="0">
438 <col width="150px" class="parameters_name">
439 <col class="parameters_description">
440 <col width="200px" class="parameters_annotations">
443 <td class="parameter_name"><p>vtable</p></td>
444 <td class="parameter_description"><p>a function table of type <span class="type">GThreadFunctions</span>, that provides
445 the entry points to the thread system to be used. Since 2.32,
446 this parameter is ignored and should always be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a></p></td>
447 <td class="parameter_annotations"> </td>
453 <div class="refsect2">
454 <a name="g-thread-supported"></a><h3>g_thread_supported ()</h3>
455 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
456 g_thread_supported ();</pre>
457 <div class="warning"><p><code class="literal">g_thread_supported</code> is deprecated and should not be used in newly-written code.</p></div>
458 <p>This macro returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the thread system is initialized,
459 and <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> if it is not.</p>
460 <p>For language bindings, <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-get-initialized" title="g_thread_get_initialized ()"><code class="function">g_thread_get_initialized()</code></a> provides
461 the same functionality as a function.</p>
462 <div class="refsect3">
463 <a name="g-thread-supported.returns"></a><h4>Returns</h4>
464 <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if the thread system is initialized</p>
468 <div class="refsect2">
469 <a name="g-thread-get-initialized"></a><h3>g_thread_get_initialized ()</h3>
470 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
471 g_thread_get_initialized (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
472 <div class="warning"><p><code class="literal">g_thread_get_initialized</code> is deprecated and should not be used in newly-written code.</p></div>
473 <p>Indicates if <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has been called.</p>
474 <div class="refsect3">
475 <a name="g-thread-get-initialized.returns"></a><h4>Returns</h4>
476 <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if threads have been initialized.</p>
478 <p class="since">Since: <a class="link" href="api-index-2-20.html#api-index-2.20">2.20</a></p>
481 <div class="refsect2">
482 <a name="g-thread-create"></a><h3>g_thread_create ()</h3>
483 <pre class="programlisting"><a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="returnvalue">GThread</span></a> *
484 g_thread_create (<em class="parameter"><code><a class="link" href="glib-Threads.html#GThreadFunc" title="GThreadFunc ()"><span class="type">GThreadFunc</span></a> func</code></em>,
485 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>,
486 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> joinable</code></em>,
487 <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
488 <div class="warning">
489 <p><code class="literal">g_thread_create</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
490 <p>Use <a class="link" href="glib-Threads.html#g-thread-new" title="g_thread_new ()"><code class="function">g_thread_new()</code></a> instead</p>
492 <p>This function creates a new thread.</p>
493 <p>The new thread executes the function <em class="parameter"><code>func</code></em>
494 with the argument <em class="parameter"><code>data</code></em>
496 If the thread was created successfully, it is returned.</p>
497 <p><em class="parameter"><code>error</code></em>
498 can be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to ignore errors, or non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to report errors.
499 The error is set, if and only if the function returns <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.</p>
500 <p>This function returns a reference to the created thread only if
501 <em class="parameter"><code>joinable</code></em>
502 is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>. In that case, you must free this reference by
503 calling <a class="link" href="glib-Threads.html#g-thread-unref" title="g_thread_unref ()"><code class="function">g_thread_unref()</code></a> or <a class="link" href="glib-Threads.html#g-thread-join" title="g_thread_join ()"><code class="function">g_thread_join()</code></a>. If <em class="parameter"><code>joinable</code></em>
504 is <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>
505 then you should probably not touch the return value.</p>
506 <div class="refsect3">
507 <a name="g-thread-create.parameters"></a><h4>Parameters</h4>
508 <div class="informaltable"><table class="informaltable" width="100%" border="0">
510 <col width="150px" class="parameters_name">
511 <col class="parameters_description">
512 <col width="200px" class="parameters_annotations">
516 <td class="parameter_name"><p>func</p></td>
517 <td class="parameter_description"><p>a function to execute in the new thread</p></td>
518 <td class="parameter_annotations"> </td>
521 <td class="parameter_name"><p>data</p></td>
522 <td class="parameter_description"><p>an argument to supply to the new thread</p></td>
523 <td class="parameter_annotations"> </td>
526 <td class="parameter_name"><p>joinable</p></td>
527 <td class="parameter_description"><p>should this thread be joinable?</p></td>
528 <td class="parameter_annotations"> </td>
531 <td class="parameter_name"><p>error</p></td>
532 <td class="parameter_description"><p>return location for error, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a></p></td>
533 <td class="parameter_annotations"> </td>
538 <div class="refsect3">
539 <a name="g-thread-create.returns"></a><h4>Returns</h4>
540 <p> the new <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> on success</p>
544 <div class="refsect2">
545 <a name="g-thread-create-full"></a><h3>g_thread_create_full ()</h3>
546 <pre class="programlisting"><a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="returnvalue">GThread</span></a> *
547 g_thread_create_full (<em class="parameter"><code><a class="link" href="glib-Threads.html#GThreadFunc" title="GThreadFunc ()"><span class="type">GThreadFunc</span></a> func</code></em>,
548 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>,
549 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gulong" title="gulong"><span class="type">gulong</span></a> stack_size</code></em>,
550 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> joinable</code></em>,
551 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> bound</code></em>,
552 <em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GThreadPriority" title="enum GThreadPriority"><span class="type">GThreadPriority</span></a> priority</code></em>,
553 <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
554 <div class="warning">
555 <p><code class="literal">g_thread_create_full</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
556 <p>The <em class="parameter"><code>bound</code></em>
557 and <em class="parameter"><code>priority</code></em>
558 arguments are now ignored.
559 Use <a class="link" href="glib-Threads.html#g-thread-new" title="g_thread_new ()"><code class="function">g_thread_new()</code></a>.</p>
561 <p>This function creates a new thread.</p>
562 <div class="refsect3">
563 <a name="g-thread-create-full.parameters"></a><h4>Parameters</h4>
564 <div class="informaltable"><table class="informaltable" width="100%" border="0">
566 <col width="150px" class="parameters_name">
567 <col class="parameters_description">
568 <col width="200px" class="parameters_annotations">
572 <td class="parameter_name"><p>func</p></td>
573 <td class="parameter_description"><p>a function to execute in the new thread.</p></td>
574 <td class="parameter_annotations"> </td>
577 <td class="parameter_name"><p>data</p></td>
578 <td class="parameter_description"><p>an argument to supply to the new thread.</p></td>
579 <td class="parameter_annotations"> </td>
582 <td class="parameter_name"><p>stack_size</p></td>
583 <td class="parameter_description"><p>a stack size for the new thread.</p></td>
584 <td class="parameter_annotations"> </td>
587 <td class="parameter_name"><p>joinable</p></td>
588 <td class="parameter_description"><p>should this thread be joinable?</p></td>
589 <td class="parameter_annotations"> </td>
592 <td class="parameter_name"><p>bound</p></td>
593 <td class="parameter_description"><p>ignored</p></td>
594 <td class="parameter_annotations"> </td>
597 <td class="parameter_name"><p>priority</p></td>
598 <td class="parameter_description"><p>ignored</p></td>
599 <td class="parameter_annotations"> </td>
602 <td class="parameter_name"><p>error</p></td>
603 <td class="parameter_description"><p>return location for error.</p></td>
604 <td class="parameter_annotations"> </td>
609 <div class="refsect3">
610 <a name="g-thread-create-full.returns"></a><h4>Returns</h4>
611 <p> the new <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> on success.</p>
615 <div class="refsect2">
616 <a name="g-thread-set-priority"></a><h3>g_thread_set_priority ()</h3>
617 <pre class="programlisting"><span class="returnvalue">void</span>
618 g_thread_set_priority (<em class="parameter"><code><a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> *thread</code></em>,
619 <em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GThreadPriority" title="enum GThreadPriority"><span class="type">GThreadPriority</span></a> priority</code></em>);</pre>
620 <div class="warning">
621 <p><code class="literal">g_thread_set_priority</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
622 <p>Thread priorities no longer have any effect.</p>
624 <p>This function does nothing.</p>
625 <div class="refsect3">
626 <a name="g-thread-set-priority.parameters"></a><h4>Parameters</h4>
627 <div class="informaltable"><table class="informaltable" width="100%" border="0">
629 <col width="150px" class="parameters_name">
630 <col class="parameters_description">
631 <col width="200px" class="parameters_annotations">
635 <td class="parameter_name"><p>thread</p></td>
636 <td class="parameter_description"><p>a <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a>.</p></td>
637 <td class="parameter_annotations"> </td>
640 <td class="parameter_name"><p>priority</p></td>
641 <td class="parameter_description"><p>ignored</p></td>
642 <td class="parameter_annotations"> </td>
649 <div class="refsect2">
650 <a name="g-thread-foreach"></a><h3>g_thread_foreach ()</h3>
651 <pre class="programlisting"><span class="returnvalue">void</span>
652 g_thread_foreach (<em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GFunc" title="GFunc ()"><span class="type">GFunc</span></a> thread_func</code></em>,
653 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
654 <div class="warning">
655 <p><code class="literal">g_thread_foreach</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
656 <p>There aren't many things you can do with a <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a>,
657 except comparing it with one that was returned from <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-create" title="g_thread_create ()"><code class="function">g_thread_create()</code></a>.
658 There are better ways to find out if your thread is still alive.</p>
660 <p>Call <em class="parameter"><code>thread_func</code></em>
661 on all <a href="glib-Threads.html#GThread"><span class="type">GThreads</span></a> that have been
662 created with <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-create" title="g_thread_create ()"><code class="function">g_thread_create()</code></a>.</p>
663 <p>Note that threads may decide to exit while <em class="parameter"><code>thread_func</code></em>
665 running, so without intimate knowledge about the lifetime of
666 foreign threads, <em class="parameter"><code>thread_func</code></em>
667 shouldn't access the GThread*
668 pointer passed in as first argument. However, <em class="parameter"><code>thread_func</code></em>
670 not be called for threads which are known to have exited already.</p>
671 <p>Due to thread lifetime checks, this function has an execution complexity
672 which is quadratic in the number of existing threads.</p>
673 <div class="refsect3">
674 <a name="g-thread-foreach.parameters"></a><h4>Parameters</h4>
675 <div class="informaltable"><table class="informaltable" width="100%" border="0">
677 <col width="150px" class="parameters_name">
678 <col class="parameters_description">
679 <col width="200px" class="parameters_annotations">
683 <td class="parameter_name"><p>thread_func</p></td>
684 <td class="parameter_description"><p>function to call for all <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> structures</p></td>
685 <td class="parameter_annotations"> </td>
688 <td class="parameter_name"><p>user_data</p></td>
689 <td class="parameter_description"><p>second argument to <em class="parameter"><code>thread_func</code></em>
691 <td class="parameter_annotations"> </td>
696 <p class="since">Since: <a class="link" href="api-index-2-10.html#api-index-2.10">2.10</a></p>
699 <div class="refsect2">
700 <a name="g-mutex-new"></a><h3>g_mutex_new ()</h3>
701 <pre class="programlisting"><a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="returnvalue">GMutex</span></a> *
702 g_mutex_new ();</pre>
703 <div class="warning">
704 <p><code class="literal">g_mutex_new</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
705 <p>GMutex can now be statically allocated, or embedded
706 in structures and initialised with <a class="link" href="glib-Threads.html#g-mutex-init" title="g_mutex_init ()"><code class="function">g_mutex_init()</code></a>.</p>
708 <p>Allocates and initializes a new <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a>.</p>
709 <div class="refsect3">
710 <a name="g-mutex-new.returns"></a><h4>Returns</h4>
711 <p> a newly allocated <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a>. Use <a class="link" href="glib-Deprecated-Thread-APIs.html#g-mutex-free" title="g_mutex_free ()"><code class="function">g_mutex_free()</code></a> to free</p>
715 <div class="refsect2">
716 <a name="g-mutex-free"></a><h3>g_mutex_free ()</h3>
717 <pre class="programlisting"><span class="returnvalue">void</span>
718 g_mutex_free (<em class="parameter"><code><a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a> *mutex</code></em>);</pre>
719 <div class="warning">
720 <p><code class="literal">g_mutex_free</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
721 <p>GMutex can now be statically allocated, or embedded
722 in structures and initialised with <a class="link" href="glib-Threads.html#g-mutex-init" title="g_mutex_init ()"><code class="function">g_mutex_init()</code></a>.</p>
724 <p>Destroys a <em class="parameter"><code>mutex</code></em>
725 that has been created with <a class="link" href="glib-Deprecated-Thread-APIs.html#g-mutex-new" title="g_mutex_new ()"><code class="function">g_mutex_new()</code></a>.</p>
726 <p>Calling <a class="link" href="glib-Deprecated-Thread-APIs.html#g-mutex-free" title="g_mutex_free ()"><code class="function">g_mutex_free()</code></a> on a locked mutex may result
727 in undefined behaviour.</p>
728 <div class="refsect3">
729 <a name="g-mutex-free.parameters"></a><h4>Parameters</h4>
730 <div class="informaltable"><table class="informaltable" width="100%" border="0">
732 <col width="150px" class="parameters_name">
733 <col class="parameters_description">
734 <col width="200px" class="parameters_annotations">
737 <td class="parameter_name"><p>mutex</p></td>
738 <td class="parameter_description"><p>a <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a></p></td>
739 <td class="parameter_annotations"> </td>
745 <div class="refsect2">
746 <a name="g-cond-new"></a><h3>g_cond_new ()</h3>
747 <pre class="programlisting"><a class="link" href="glib-Threads.html#GCond" title="struct GCond"><span class="returnvalue">GCond</span></a>*
749 <div class="warning">
750 <p><code class="literal">g_cond_new</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
751 <p>GCond can now be statically allocated, or embedded
752 in structures and initialised with <a class="link" href="glib-Threads.html#g-cond-init" title="g_cond_init ()"><code class="function">g_cond_init()</code></a>.</p>
754 <p>Allocates and initializes a new <a class="link" href="glib-Threads.html#GCond" title="struct GCond"><span class="type">GCond</span></a>.</p>
755 <div class="refsect3">
756 <a name="g-cond-new.returns"></a><h4>Returns</h4>
757 <p> a newly allocated <a class="link" href="glib-Threads.html#GCond" title="struct GCond"><span class="type">GCond</span></a>. Free with <a class="link" href="glib-Deprecated-Thread-APIs.html#g-cond-free" title="g_cond_free ()"><code class="function">g_cond_free()</code></a></p>
761 <div class="refsect2">
762 <a name="g-cond-free"></a><h3>g_cond_free ()</h3>
763 <pre class="programlisting"><span class="returnvalue">void</span>
764 g_cond_free (<em class="parameter"><code><a class="link" href="glib-Threads.html#GCond" title="struct GCond"><span class="type">GCond</span></a> *cond</code></em>);</pre>
765 <div class="warning">
766 <p><code class="literal">g_cond_free</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
767 <p>GCond can now be statically allocated, or embedded
768 in structures and initialised with <a class="link" href="glib-Threads.html#g-cond-init" title="g_cond_init ()"><code class="function">g_cond_init()</code></a>.</p>
770 <p>Destroys a <a class="link" href="glib-Threads.html#GCond" title="struct GCond"><span class="type">GCond</span></a> that has been created with <a class="link" href="glib-Deprecated-Thread-APIs.html#g-cond-new" title="g_cond_new ()"><code class="function">g_cond_new()</code></a>.</p>
771 <p>Calling <a class="link" href="glib-Deprecated-Thread-APIs.html#g-cond-free" title="g_cond_free ()"><code class="function">g_cond_free()</code></a> for a <a class="link" href="glib-Threads.html#GCond" title="struct GCond"><span class="type">GCond</span></a> on which threads are
772 blocking leads to undefined behaviour.</p>
773 <div class="refsect3">
774 <a name="g-cond-free.parameters"></a><h4>Parameters</h4>
775 <div class="informaltable"><table class="informaltable" width="100%" border="0">
777 <col width="150px" class="parameters_name">
778 <col class="parameters_description">
779 <col width="200px" class="parameters_annotations">
782 <td class="parameter_name"><p>cond</p></td>
783 <td class="parameter_description"><p>a <a class="link" href="glib-Threads.html#GCond" title="struct GCond"><span class="type">GCond</span></a></p></td>
784 <td class="parameter_annotations"> </td>
790 <div class="refsect2">
791 <a name="g-private-new"></a><h3>g_private_new ()</h3>
792 <pre class="programlisting"><a class="link" href="glib-Threads.html#GPrivate" title="struct GPrivate"><span class="returnvalue">GPrivate</span></a> *
793 g_private_new (<em class="parameter"><code><a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="type">GDestroyNotify</span></a> notify</code></em>);</pre>
794 <div class="warning">
795 <p><code class="literal">g_private_new</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
796 <p>dynamic allocation of <a class="link" href="glib-Threads.html#GPrivate" title="struct GPrivate"><span class="type">GPrivate</span></a> is a bad idea. Use
797 static storage and <a class="link" href="glib-Threads.html#G-PRIVATE-INIT:CAPS" title="G_PRIVATE_INIT()"><code class="function">G_PRIVATE_INIT()</code></a> instead.</p>
799 <p>Creates a new <a class="link" href="glib-Threads.html#GPrivate" title="struct GPrivate"><span class="type">GPrivate</span></a>.</p>
800 <div class="refsect3">
801 <a name="g-private-new.parameters"></a><h4>Parameters</h4>
802 <div class="informaltable"><table class="informaltable" width="100%" border="0">
804 <col width="150px" class="parameters_name">
805 <col class="parameters_description">
806 <col width="200px" class="parameters_annotations">
809 <td class="parameter_name"><p>notify</p></td>
810 <td class="parameter_description"><p>a <a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="type">GDestroyNotify</span></a></p></td>
811 <td class="parameter_annotations"> </td>
815 <div class="refsect3">
816 <a name="g-private-new.returns"></a><h4>Returns</h4>
817 <p> a newly allocated <a class="link" href="glib-Threads.html#GPrivate" title="struct GPrivate"><span class="type">GPrivate</span></a> (which can never be destroyed)</p>
821 <div class="refsect2">
822 <a name="g-static-mutex-init"></a><h3>g_static_mutex_init ()</h3>
823 <pre class="programlisting"><span class="returnvalue">void</span>
824 g_static_mutex_init (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
825 <div class="warning">
826 <p><code class="literal">g_static_mutex_init</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
827 <p>Use <a class="link" href="glib-Threads.html#g-mutex-init" title="g_mutex_init ()"><code class="function">g_mutex_init()</code></a></p>
829 <p>Initializes <em class="parameter"><code>mutex</code></em>
831 Alternatively you can initialize it with <a class="link" href="glib-Deprecated-Thread-APIs.html#G-STATIC-MUTEX-INIT:CAPS" title="G_STATIC_MUTEX_INIT"><span class="type">G_STATIC_MUTEX_INIT</span></a>.</p>
832 <div class="refsect3">
833 <a name="g-static-mutex-init.parameters"></a><h4>Parameters</h4>
834 <div class="informaltable"><table class="informaltable" width="100%" border="0">
836 <col width="150px" class="parameters_name">
837 <col class="parameters_description">
838 <col width="200px" class="parameters_annotations">
841 <td class="parameter_name"><p>mutex</p></td>
842 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> to be initialized.</p></td>
843 <td class="parameter_annotations"> </td>
849 <div class="refsect2">
850 <a name="g-static-mutex-lock"></a><h3>g_static_mutex_lock ()</h3>
851 <pre class="programlisting"><span class="returnvalue">void</span>
852 g_static_mutex_lock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
853 <div class="warning">
854 <p><code class="literal">g_static_mutex_lock</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
855 <p>Use <a class="link" href="glib-Threads.html#g-mutex-lock" title="g_mutex_lock ()"><code class="function">g_mutex_lock()</code></a></p>
857 <p>Works like <a class="link" href="glib-Threads.html#g-mutex-lock" title="g_mutex_lock ()"><code class="function">g_mutex_lock()</code></a>, but for a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p>
858 <div class="refsect3">
859 <a name="g-static-mutex-lock.parameters"></a><h4>Parameters</h4>
860 <div class="informaltable"><table class="informaltable" width="100%" border="0">
862 <col width="150px" class="parameters_name">
863 <col class="parameters_description">
864 <col width="200px" class="parameters_annotations">
867 <td class="parameter_name"><p>mutex</p></td>
868 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p></td>
869 <td class="parameter_annotations"> </td>
875 <div class="refsect2">
876 <a name="g-static-mutex-trylock"></a><h3>g_static_mutex_trylock ()</h3>
877 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
878 g_static_mutex_trylock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
879 <div class="warning">
880 <p><code class="literal">g_static_mutex_trylock</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
881 <p>Use <a class="link" href="glib-Threads.html#g-mutex-trylock" title="g_mutex_trylock ()"><code class="function">g_mutex_trylock()</code></a></p>
883 <p>Works like <a class="link" href="glib-Threads.html#g-mutex-trylock" title="g_mutex_trylock ()"><code class="function">g_mutex_trylock()</code></a>, but for a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p>
884 <div class="refsect3">
885 <a name="g-static-mutex-trylock.parameters"></a><h4>Parameters</h4>
886 <div class="informaltable"><table class="informaltable" width="100%" border="0">
888 <col width="150px" class="parameters_name">
889 <col class="parameters_description">
890 <col width="200px" class="parameters_annotations">
893 <td class="parameter_name"><p>mutex</p></td>
894 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p></td>
895 <td class="parameter_annotations"> </td>
899 <div class="refsect3">
900 <a name="g-static-mutex-trylock.returns"></a><h4>Returns</h4>
901 <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if the <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> could be locked.</p>
905 <div class="refsect2">
906 <a name="g-static-mutex-unlock"></a><h3>g_static_mutex_unlock ()</h3>
907 <pre class="programlisting"><span class="returnvalue">void</span>
908 g_static_mutex_unlock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
909 <div class="warning">
910 <p><code class="literal">g_static_mutex_unlock</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
911 <p>Use <a class="link" href="glib-Threads.html#g-mutex-unlock" title="g_mutex_unlock ()"><code class="function">g_mutex_unlock()</code></a></p>
913 <p>Works like <a class="link" href="glib-Threads.html#g-mutex-unlock" title="g_mutex_unlock ()"><code class="function">g_mutex_unlock()</code></a>, but for a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p>
914 <div class="refsect3">
915 <a name="g-static-mutex-unlock.parameters"></a><h4>Parameters</h4>
916 <div class="informaltable"><table class="informaltable" width="100%" border="0">
918 <col width="150px" class="parameters_name">
919 <col class="parameters_description">
920 <col width="200px" class="parameters_annotations">
923 <td class="parameter_name"><p>mutex</p></td>
924 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p></td>
925 <td class="parameter_annotations"> </td>
931 <div class="refsect2">
932 <a name="g-static-mutex-get-mutex"></a><h3>g_static_mutex_get_mutex ()</h3>
933 <pre class="programlisting"><a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="returnvalue">GMutex</span></a> *
934 g_static_mutex_get_mutex (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
935 <div class="warning">
936 <p><code class="literal">g_static_mutex_get_mutex</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
937 <p>Just use a <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a></p>
939 <p>For some operations (like <a class="link" href="glib-Threads.html#g-cond-wait" title="g_cond_wait ()"><code class="function">g_cond_wait()</code></a>) you must have a <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a>
940 instead of a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>. This function will return the
941 corresponding <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a> for <em class="parameter"><code>mutex</code></em>
943 <div class="refsect3">
944 <a name="g-static-mutex-get-mutex.parameters"></a><h4>Parameters</h4>
945 <div class="informaltable"><table class="informaltable" width="100%" border="0">
947 <col width="150px" class="parameters_name">
948 <col class="parameters_description">
949 <col width="200px" class="parameters_annotations">
952 <td class="parameter_name"><p>mutex</p></td>
953 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p></td>
954 <td class="parameter_annotations"> </td>
958 <div class="refsect3">
959 <a name="g-static-mutex-get-mutex.returns"></a><h4>Returns</h4>
960 <p> the <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a> corresponding to <em class="parameter"><code>mutex</code></em>
965 <div class="refsect2">
966 <a name="g-static-mutex-free"></a><h3>g_static_mutex_free ()</h3>
967 <pre class="programlisting"><span class="returnvalue">void</span>
968 g_static_mutex_free (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
969 <div class="warning">
970 <p><code class="literal">g_static_mutex_free</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
971 <p>Use <a class="link" href="glib-Threads.html#g-mutex-clear" title="g_mutex_clear ()"><code class="function">g_mutex_clear()</code></a></p>
973 <p>Releases all resources allocated to <em class="parameter"><code>mutex</code></em>
975 <p>You don't have to call this functions for a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> with an
976 unbounded lifetime, i.e. objects declared 'static', but if you have
977 a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> as a member of a structure and the structure is
978 freed, you should also free the <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p>
979 <p>Calling <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-free" title="g_static_mutex_free ()"><code class="function">g_static_mutex_free()</code></a> on a locked mutex may result in
980 undefined behaviour.</p>
981 <div class="refsect3">
982 <a name="g-static-mutex-free.parameters"></a><h4>Parameters</h4>
983 <div class="informaltable"><table class="informaltable" width="100%" border="0">
985 <col width="150px" class="parameters_name">
986 <col class="parameters_description">
987 <col width="200px" class="parameters_annotations">
990 <td class="parameter_name"><p>mutex</p></td>
991 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> to be freed.</p></td>
992 <td class="parameter_annotations"> </td>
998 <div class="refsect2">
999 <a name="g-static-rec-mutex-init"></a><h3>g_static_rec_mutex_init ()</h3>
1000 <pre class="programlisting"><span class="returnvalue">void</span>
1001 g_static_rec_mutex_init (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
1002 <div class="warning">
1003 <p><code class="literal">g_static_rec_mutex_init</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
1004 <p>Use <a class="link" href="glib-Threads.html#g-rec-mutex-init" title="g_rec_mutex_init ()"><code class="function">g_rec_mutex_init()</code></a></p>
1006 <p>A <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> must be initialized with this function before it
1007 can be used. Alternatively you can initialize it with
1008 <a class="link" href="glib-Deprecated-Thread-APIs.html#G-STATIC-REC-MUTEX-INIT:CAPS" title="G_STATIC_REC_MUTEX_INIT"><span class="type">G_STATIC_REC_MUTEX_INIT</span></a>.</p>
1009 <div class="refsect3">
1010 <a name="g-static-rec-mutex-init.parameters"></a><h4>Parameters</h4>
1011 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1013 <col width="150px" class="parameters_name">
1014 <col class="parameters_description">
1015 <col width="200px" class="parameters_annotations">
1018 <td class="parameter_name"><p>mutex</p></td>
1019 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to be initialized.</p></td>
1020 <td class="parameter_annotations"> </td>
1026 <div class="refsect2">
1027 <a name="g-static-rec-mutex-lock"></a><h3>g_static_rec_mutex_lock ()</h3>
1028 <pre class="programlisting"><span class="returnvalue">void</span>
1029 g_static_rec_mutex_lock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
1030 <div class="warning">
1031 <p><code class="literal">g_static_rec_mutex_lock</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
1032 <p>Use <a class="link" href="glib-Threads.html#g-rec-mutex-lock" title="g_rec_mutex_lock ()"><code class="function">g_rec_mutex_lock()</code></a></p>
1034 <p>Locks <em class="parameter"><code>mutex</code></em>
1035 . If <em class="parameter"><code>mutex</code></em>
1036 is already locked by another thread, the
1037 current thread will block until <em class="parameter"><code>mutex</code></em>
1038 is unlocked by the other
1039 thread. If <em class="parameter"><code>mutex</code></em>
1040 is already locked by the calling thread, this
1041 functions increases the depth of <em class="parameter"><code>mutex</code></em>
1042 and returns immediately.</p>
1043 <div class="refsect3">
1044 <a name="g-static-rec-mutex-lock.parameters"></a><h4>Parameters</h4>
1045 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1047 <col width="150px" class="parameters_name">
1048 <col class="parameters_description">
1049 <col width="200px" class="parameters_annotations">
1052 <td class="parameter_name"><p>mutex</p></td>
1053 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to lock.</p></td>
1054 <td class="parameter_annotations"> </td>
1060 <div class="refsect2">
1061 <a name="g-static-rec-mutex-trylock"></a><h3>g_static_rec_mutex_trylock ()</h3>
1062 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
1063 g_static_rec_mutex_trylock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
1064 <div class="warning">
1065 <p><code class="literal">g_static_rec_mutex_trylock</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
1066 <p>Use <a class="link" href="glib-Threads.html#g-rec-mutex-trylock" title="g_rec_mutex_trylock ()"><code class="function">g_rec_mutex_trylock()</code></a></p>
1068 <p>Tries to lock <em class="parameter"><code>mutex</code></em>
1069 . If <em class="parameter"><code>mutex</code></em>
1070 is already locked by another thread,
1071 it immediately returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>. Otherwise it locks <em class="parameter"><code>mutex</code></em>
1073 <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>. If <em class="parameter"><code>mutex</code></em>
1074 is already locked by the calling thread, this
1075 functions increases the depth of <em class="parameter"><code>mutex</code></em>
1076 and immediately returns
1077 <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.</p>
1078 <div class="refsect3">
1079 <a name="g-static-rec-mutex-trylock.parameters"></a><h4>Parameters</h4>
1080 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1082 <col width="150px" class="parameters_name">
1083 <col class="parameters_description">
1084 <col width="200px" class="parameters_annotations">
1087 <td class="parameter_name"><p>mutex</p></td>
1088 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to lock.</p></td>
1089 <td class="parameter_annotations"> </td>
1093 <div class="refsect3">
1094 <a name="g-static-rec-mutex-trylock.returns"></a><h4>Returns</h4>
1095 <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if <em class="parameter"><code>mutex</code></em>
1096 could be locked.</p>
1100 <div class="refsect2">
1101 <a name="g-static-rec-mutex-unlock"></a><h3>g_static_rec_mutex_unlock ()</h3>
1102 <pre class="programlisting"><span class="returnvalue">void</span>
1103 g_static_rec_mutex_unlock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
1104 <div class="warning">
1105 <p><code class="literal">g_static_rec_mutex_unlock</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
1106 <p>Use <a class="link" href="glib-Threads.html#g-rec-mutex-unlock" title="g_rec_mutex_unlock ()"><code class="function">g_rec_mutex_unlock()</code></a></p>
1108 <p>Unlocks <em class="parameter"><code>mutex</code></em>
1109 . Another thread will be allowed to lock <em class="parameter"><code>mutex</code></em>
1111 when it has been unlocked as many times as it had been locked
1112 before. If <em class="parameter"><code>mutex</code></em>
1113 is completely unlocked and another thread is
1114 blocked in a <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-lock" title="g_static_rec_mutex_lock ()"><code class="function">g_static_rec_mutex_lock()</code></a> call for <em class="parameter"><code>mutex</code></em>
1116 woken and can lock <em class="parameter"><code>mutex</code></em>
1118 <div class="refsect3">
1119 <a name="g-static-rec-mutex-unlock.parameters"></a><h4>Parameters</h4>
1120 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1122 <col width="150px" class="parameters_name">
1123 <col class="parameters_description">
1124 <col width="200px" class="parameters_annotations">
1127 <td class="parameter_name"><p>mutex</p></td>
1128 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to unlock.</p></td>
1129 <td class="parameter_annotations"> </td>
1135 <div class="refsect2">
1136 <a name="g-static-rec-mutex-lock-full"></a><h3>g_static_rec_mutex_lock_full ()</h3>
1137 <pre class="programlisting"><span class="returnvalue">void</span>
1138 g_static_rec_mutex_lock_full (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>,
1139 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="type">guint</span></a> depth</code></em>);</pre>
1140 <div class="warning">
1141 <p><code class="literal">g_static_rec_mutex_lock_full</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
1142 <p>Use <a class="link" href="glib-Threads.html#g-rec-mutex-lock" title="g_rec_mutex_lock ()"><code class="function">g_rec_mutex_lock()</code></a></p>
1144 <p>Works like calling <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-lock" title="g_static_rec_mutex_lock ()"><code class="function">g_static_rec_mutex_lock()</code></a> for <em class="parameter"><code>mutex</code></em>
1145 <em class="parameter"><code>depth</code></em>
1147 <div class="refsect3">
1148 <a name="g-static-rec-mutex-lock-full.parameters"></a><h4>Parameters</h4>
1149 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1151 <col width="150px" class="parameters_name">
1152 <col class="parameters_description">
1153 <col width="200px" class="parameters_annotations">
1157 <td class="parameter_name"><p>mutex</p></td>
1158 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to lock.</p></td>
1159 <td class="parameter_annotations"> </td>
1162 <td class="parameter_name"><p>depth</p></td>
1163 <td class="parameter_description"><p>number of times this mutex has to be unlocked to be
1164 completely unlocked.</p></td>
1165 <td class="parameter_annotations"> </td>
1172 <div class="refsect2">
1173 <a name="g-static-rec-mutex-unlock-full"></a><h3>g_static_rec_mutex_unlock_full ()</h3>
1174 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="returnvalue">guint</span></a>
1175 g_static_rec_mutex_unlock_full (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
1176 <div class="warning">
1177 <p><code class="literal">g_static_rec_mutex_unlock_full</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
1178 <p>Use <a class="link" href="glib-Threads.html#g-rec-mutex-unlock" title="g_rec_mutex_unlock ()"><code class="function">g_rec_mutex_unlock()</code></a></p>
1180 <p>Completely unlocks <em class="parameter"><code>mutex</code></em>
1181 . If another thread is blocked in a
1182 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-lock" title="g_static_rec_mutex_lock ()"><code class="function">g_static_rec_mutex_lock()</code></a> call for <em class="parameter"><code>mutex</code></em>
1183 , it will be woken and can
1184 lock <em class="parameter"><code>mutex</code></em>
1185 itself. This function returns the number of times that
1186 <em class="parameter"><code>mutex</code></em>
1187 has been locked by the current thread. To restore the state
1188 before the call to <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-unlock-full" title="g_static_rec_mutex_unlock_full ()"><code class="function">g_static_rec_mutex_unlock_full()</code></a> you can call
1189 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-lock-full" title="g_static_rec_mutex_lock_full ()"><code class="function">g_static_rec_mutex_lock_full()</code></a> with the depth returned by this
1191 <div class="refsect3">
1192 <a name="g-static-rec-mutex-unlock-full.parameters"></a><h4>Parameters</h4>
1193 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1195 <col width="150px" class="parameters_name">
1196 <col class="parameters_description">
1197 <col width="200px" class="parameters_annotations">
1200 <td class="parameter_name"><p>mutex</p></td>
1201 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to completely unlock.</p></td>
1202 <td class="parameter_annotations"> </td>
1206 <div class="refsect3">
1207 <a name="g-static-rec-mutex-unlock-full.returns"></a><h4>Returns</h4>
1208 <p> number of times <em class="parameter"><code>mutex</code></em>
1209 has been locked by the current
1214 <div class="refsect2">
1215 <a name="g-static-rec-mutex-free"></a><h3>g_static_rec_mutex_free ()</h3>
1216 <pre class="programlisting"><span class="returnvalue">void</span>
1217 g_static_rec_mutex_free (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
1218 <div class="warning">
1219 <p><code class="literal">g_static_rec_mutex_free</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
1220 <p>Use <a class="link" href="glib-Threads.html#g-rec-mutex-clear" title="g_rec_mutex_clear ()"><code class="function">g_rec_mutex_clear()</code></a></p>
1222 <p>Releases all resources allocated to a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a>.</p>
1223 <p>You don't have to call this functions for a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> with an
1224 unbounded lifetime, i.e. objects declared 'static', but if you have
1225 a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> as a member of a structure and the structure is
1226 freed, you should also free the <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a>.</p>
1227 <div class="refsect3">
1228 <a name="g-static-rec-mutex-free.parameters"></a><h4>Parameters</h4>
1229 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1231 <col width="150px" class="parameters_name">
1232 <col class="parameters_description">
1233 <col width="200px" class="parameters_annotations">
1236 <td class="parameter_name"><p>mutex</p></td>
1237 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to be freed.</p></td>
1238 <td class="parameter_annotations"> </td>
1244 <div class="refsect2">
1245 <a name="g-static-rw-lock-init"></a><h3>g_static_rw_lock_init ()</h3>
1246 <pre class="programlisting"><span class="returnvalue">void</span>
1247 g_static_rw_lock_init (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
1248 <div class="warning">
1249 <p><code class="literal">g_static_rw_lock_init</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
1250 <p>Use <a class="link" href="glib-Threads.html#g-rw-lock-init" title="g_rw_lock_init ()"><code class="function">g_rw_lock_init()</code></a> instead</p>
1252 <p>A <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> must be initialized with this function before it
1253 can be used. Alternatively you can initialize it with
1254 <a class="link" href="glib-Deprecated-Thread-APIs.html#G-STATIC-RW-LOCK-INIT:CAPS" title="G_STATIC_RW_LOCK_INIT"><span class="type">G_STATIC_RW_LOCK_INIT</span></a>.</p>
1255 <div class="refsect3">
1256 <a name="g-static-rw-lock-init.parameters"></a><h4>Parameters</h4>
1257 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1259 <col width="150px" class="parameters_name">
1260 <col class="parameters_description">
1261 <col width="200px" class="parameters_annotations">
1264 <td class="parameter_name"><p>lock</p></td>
1265 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> to be initialized.</p></td>
1266 <td class="parameter_annotations"> </td>
1272 <div class="refsect2">
1273 <a name="g-static-rw-lock-reader-lock"></a><h3>g_static_rw_lock_reader_lock ()</h3>
1274 <pre class="programlisting"><span class="returnvalue">void</span>
1275 g_static_rw_lock_reader_lock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
1276 <div class="warning">
1277 <p><code class="literal">g_static_rw_lock_reader_lock</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
1278 <p>Use <a class="link" href="glib-Threads.html#g-rw-lock-reader-lock" title="g_rw_lock_reader_lock ()"><code class="function">g_rw_lock_reader_lock()</code></a> instead</p>
1280 <p>Locks <em class="parameter"><code>lock</code></em>
1281 for reading. There may be unlimited concurrent locks for
1282 reading of a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> at the same time. If <em class="parameter"><code>lock</code></em>
1284 locked for writing by another thread or if another thread is already
1285 waiting to lock <em class="parameter"><code>lock</code></em>
1286 for writing, this function will block until
1287 <em class="parameter"><code>lock</code></em>
1288 is unlocked by the other writing thread and no other writing
1289 threads want to lock <em class="parameter"><code>lock</code></em>
1290 . This lock has to be unlocked by
1291 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-unlock" title="g_static_rw_lock_reader_unlock ()"><code class="function">g_static_rw_lock_reader_unlock()</code></a>.</p>
1292 <p><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> is not recursive. It might seem to be possible to
1293 recursively lock for reading, but that can result in a deadlock, due
1294 to writer preference.</p>
1295 <div class="refsect3">
1296 <a name="g-static-rw-lock-reader-lock.parameters"></a><h4>Parameters</h4>
1297 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1299 <col width="150px" class="parameters_name">
1300 <col class="parameters_description">
1301 <col width="200px" class="parameters_annotations">
1304 <td class="parameter_name"><p>lock</p></td>
1305 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> to lock for reading.</p></td>
1306 <td class="parameter_annotations"> </td>
1312 <div class="refsect2">
1313 <a name="g-static-rw-lock-reader-trylock"></a><h3>g_static_rw_lock_reader_trylock ()</h3>
1314 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
1315 g_static_rw_lock_reader_trylock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
1316 <div class="warning"><p><code class="literal">g_static_rw_lock_reader_trylock</code> is deprecated and should not be used in newly-written code.</p></div>
1317 <p>Tries to lock <em class="parameter"><code>lock</code></em>
1318 for reading. If <em class="parameter"><code>lock</code></em>
1319 is already locked for
1320 writing by another thread or if another thread is already waiting to
1321 lock <em class="parameter"><code>lock</code></em>
1322 for writing, immediately returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>. Otherwise locks
1323 <em class="parameter"><code>lock</code></em>
1324 for reading and returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>. This lock has to be unlocked by
1325 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-unlock" title="g_static_rw_lock_reader_unlock ()"><code class="function">g_static_rw_lock_reader_unlock()</code></a>.</p>
1326 <div class="refsect3">
1327 <a name="g-static-rw-lock-reader-trylock.parameters"></a><h4>Parameters</h4>
1328 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1330 <col width="150px" class="parameters_name">
1331 <col class="parameters_description">
1332 <col width="200px" class="parameters_annotations">
1335 <td class="parameter_name"><p>lock</p></td>
1336 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> to lock for reading</p></td>
1337 <td class="parameter_annotations"> </td>
1341 <div class="refsect3">
1342 <a name="g-static-rw-lock-reader-trylock.returns"></a><h4>Returns</h4>
1343 <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if <em class="parameter"><code>lock</code></em>
1344 could be locked for reading</p>
1345 <p>Deprectated: 2.32: Use <a class="link" href="glib-Threads.html#g-rw-lock-reader-trylock" title="g_rw_lock_reader_trylock ()"><code class="function">g_rw_lock_reader_trylock()</code></a> instead</p>
1349 <div class="refsect2">
1350 <a name="g-static-rw-lock-reader-unlock"></a><h3>g_static_rw_lock_reader_unlock ()</h3>
1351 <pre class="programlisting"><span class="returnvalue">void</span>
1352 g_static_rw_lock_reader_unlock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
1353 <div class="warning"><p><code class="literal">g_static_rw_lock_reader_unlock</code> is deprecated and should not be used in newly-written code.</p></div>
1354 <p>Unlocks <em class="parameter"><code>lock</code></em>
1355 . If a thread waits to lock <em class="parameter"><code>lock</code></em>
1357 locks for reading have been unlocked, the waiting thread is woken up
1358 and can lock <em class="parameter"><code>lock</code></em>
1360 <p>Deprectated: 2.32: Use <a class="link" href="glib-Threads.html#g-rw-lock-reader-unlock" title="g_rw_lock_reader_unlock ()"><code class="function">g_rw_lock_reader_unlock()</code></a> instead</p>
1361 <div class="refsect3">
1362 <a name="g-static-rw-lock-reader-unlock.parameters"></a><h4>Parameters</h4>
1363 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1365 <col width="150px" class="parameters_name">
1366 <col class="parameters_description">
1367 <col width="200px" class="parameters_annotations">
1370 <td class="parameter_name"><p>lock</p></td>
1371 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> to unlock after reading</p></td>
1372 <td class="parameter_annotations"> </td>
1378 <div class="refsect2">
1379 <a name="g-static-rw-lock-writer-lock"></a><h3>g_static_rw_lock_writer_lock ()</h3>
1380 <pre class="programlisting"><span class="returnvalue">void</span>
1381 g_static_rw_lock_writer_lock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
1382 <div class="warning"><p><code class="literal">g_static_rw_lock_writer_lock</code> is deprecated and should not be used in newly-written code.</p></div>
1383 <p>Locks <em class="parameter"><code>lock</code></em>
1384 for writing. If <em class="parameter"><code>lock</code></em>
1385 is already locked for writing or
1386 reading by other threads, this function will block until <em class="parameter"><code>lock</code></em>
1388 completely unlocked and then lock <em class="parameter"><code>lock</code></em>
1389 for writing. While this
1390 functions waits to lock <em class="parameter"><code>lock</code></em>
1391 , no other thread can lock <em class="parameter"><code>lock</code></em>
1393 reading. When <em class="parameter"><code>lock</code></em>
1394 is locked for writing, no other thread can lock
1395 <em class="parameter"><code>lock</code></em>
1396 (neither for reading nor writing). This lock has to be
1397 unlocked by <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-writer-unlock" title="g_static_rw_lock_writer_unlock ()"><code class="function">g_static_rw_lock_writer_unlock()</code></a>.</p>
1398 <p>Deprectated: 2.32: Use <a class="link" href="glib-Threads.html#g-rw-lock-writer-lock" title="g_rw_lock_writer_lock ()"><code class="function">g_rw_lock_writer_lock()</code></a> instead</p>
1399 <div class="refsect3">
1400 <a name="g-static-rw-lock-writer-lock.parameters"></a><h4>Parameters</h4>
1401 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1403 <col width="150px" class="parameters_name">
1404 <col class="parameters_description">
1405 <col width="200px" class="parameters_annotations">
1408 <td class="parameter_name"><p>lock</p></td>
1409 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> to lock for writing</p></td>
1410 <td class="parameter_annotations"> </td>
1416 <div class="refsect2">
1417 <a name="g-static-rw-lock-writer-trylock"></a><h3>g_static_rw_lock_writer_trylock ()</h3>
1418 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
1419 g_static_rw_lock_writer_trylock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
1420 <div class="warning"><p><code class="literal">g_static_rw_lock_writer_trylock</code> is deprecated and should not be used in newly-written code.</p></div>
1421 <p>Tries to lock <em class="parameter"><code>lock</code></em>
1422 for writing. If <em class="parameter"><code>lock</code></em>
1423 is already locked (for
1424 either reading or writing) by another thread, it immediately returns
1425 <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>. Otherwise it locks <em class="parameter"><code>lock</code></em>
1426 for writing and returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>. This
1427 lock has to be unlocked by <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-writer-unlock" title="g_static_rw_lock_writer_unlock ()"><code class="function">g_static_rw_lock_writer_unlock()</code></a>.</p>
1428 <div class="refsect3">
1429 <a name="g-static-rw-lock-writer-trylock.parameters"></a><h4>Parameters</h4>
1430 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1432 <col width="150px" class="parameters_name">
1433 <col class="parameters_description">
1434 <col width="200px" class="parameters_annotations">
1437 <td class="parameter_name"><p>lock</p></td>
1438 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> to lock for writing</p></td>
1439 <td class="parameter_annotations"> </td>
1443 <div class="refsect3">
1444 <a name="g-static-rw-lock-writer-trylock.returns"></a><h4>Returns</h4>
1445 <p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if <em class="parameter"><code>lock</code></em>
1446 could be locked for writing</p>
1447 <p>Deprectated: 2.32: Use <a class="link" href="glib-Threads.html#g-rw-lock-writer-trylock" title="g_rw_lock_writer_trylock ()"><code class="function">g_rw_lock_writer_trylock()</code></a> instead</p>
1451 <div class="refsect2">
1452 <a name="g-static-rw-lock-writer-unlock"></a><h3>g_static_rw_lock_writer_unlock ()</h3>
1453 <pre class="programlisting"><span class="returnvalue">void</span>
1454 g_static_rw_lock_writer_unlock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
1455 <div class="warning"><p><code class="literal">g_static_rw_lock_writer_unlock</code> is deprecated and should not be used in newly-written code.</p></div>
1456 <p>Unlocks <em class="parameter"><code>lock</code></em>
1457 . If a thread is waiting to lock <em class="parameter"><code>lock</code></em>
1459 all locks for reading have been unlocked, the waiting thread is
1460 woken up and can lock <em class="parameter"><code>lock</code></em>
1461 for writing. If no thread is waiting to
1462 lock <em class="parameter"><code>lock</code></em>
1463 for writing, and some thread or threads are waiting to
1464 lock <em class="parameter"><code>lock</code></em>
1465 for reading, the waiting threads are woken up and can
1466 lock <em class="parameter"><code>lock</code></em>
1468 <p>Deprectated: 2.32: Use <a class="link" href="glib-Threads.html#g-rw-lock-writer-unlock" title="g_rw_lock_writer_unlock ()"><code class="function">g_rw_lock_writer_unlock()</code></a> instead</p>
1469 <div class="refsect3">
1470 <a name="g-static-rw-lock-writer-unlock.parameters"></a><h4>Parameters</h4>
1471 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1473 <col width="150px" class="parameters_name">
1474 <col class="parameters_description">
1475 <col width="200px" class="parameters_annotations">
1478 <td class="parameter_name"><p>lock</p></td>
1479 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> to unlock after writing.</p></td>
1480 <td class="parameter_annotations"> </td>
1486 <div class="refsect2">
1487 <a name="g-static-rw-lock-free"></a><h3>g_static_rw_lock_free ()</h3>
1488 <pre class="programlisting"><span class="returnvalue">void</span>
1489 g_static_rw_lock_free (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
1490 <div class="warning">
1491 <p><code class="literal">g_static_rw_lock_free</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
1492 <p>Use a <a class="link" href="glib-Threads.html#GRWLock" title="struct GRWLock"><span class="type">GRWLock</span></a> instead</p>
1494 <p>Releases all resources allocated to <em class="parameter"><code>lock</code></em>
1496 <p>You don't have to call this functions for a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> with an
1497 unbounded lifetime, i.e. objects declared 'static', but if you have
1498 a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> as a member of a structure, and the structure is
1499 freed, you should also free the <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a>.</p>
1500 <div class="refsect3">
1501 <a name="g-static-rw-lock-free.parameters"></a><h4>Parameters</h4>
1502 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1504 <col width="150px" class="parameters_name">
1505 <col class="parameters_description">
1506 <col width="200px" class="parameters_annotations">
1509 <td class="parameter_name"><p>lock</p></td>
1510 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> to be freed.</p></td>
1511 <td class="parameter_annotations"> </td>
1517 <div class="refsect2">
1518 <a name="g-static-private-init"></a><h3>g_static_private_init ()</h3>
1519 <pre class="programlisting"><span class="returnvalue">void</span>
1520 g_static_private_init (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> *private_key</code></em>);</pre>
1521 <div class="warning"><p><code class="literal">g_static_private_init</code> is deprecated and should not be used in newly-written code.</p></div>
1522 <p>Initializes <em class="parameter"><code>private_key</code></em>
1523 . Alternatively you can initialize it with
1524 <a class="link" href="glib-Deprecated-Thread-APIs.html#G-STATIC-PRIVATE-INIT:CAPS" title="G_STATIC_PRIVATE_INIT"><span class="type">G_STATIC_PRIVATE_INIT</span></a>.</p>
1525 <div class="refsect3">
1526 <a name="g-static-private-init.parameters"></a><h4>Parameters</h4>
1527 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1529 <col width="150px" class="parameters_name">
1530 <col class="parameters_description">
1531 <col width="200px" class="parameters_annotations">
1534 <td class="parameter_name"><p>private_key</p></td>
1535 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> to be initialized</p></td>
1536 <td class="parameter_annotations"> </td>
1542 <div class="refsect2">
1543 <a name="g-static-private-get"></a><h3>g_static_private_get ()</h3>
1544 <pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>
1545 g_static_private_get (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> *private_key</code></em>);</pre>
1546 <div class="warning"><p><code class="literal">g_static_private_get</code> is deprecated and should not be used in newly-written code.</p></div>
1547 <p>Works like <a class="link" href="glib-Threads.html#g-private-get" title="g_private_get ()"><code class="function">g_private_get()</code></a> only for a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a>.</p>
1548 <p>This function works even if <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not yet been called.</p>
1549 <div class="refsect3">
1550 <a name="g-static-private-get.parameters"></a><h4>Parameters</h4>
1551 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1553 <col width="150px" class="parameters_name">
1554 <col class="parameters_description">
1555 <col width="200px" class="parameters_annotations">
1558 <td class="parameter_name"><p>private_key</p></td>
1559 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a></p></td>
1560 <td class="parameter_annotations"> </td>
1564 <div class="refsect3">
1565 <a name="g-static-private-get.returns"></a><h4>Returns</h4>
1566 <p> the corresponding pointer</p>
1570 <div class="refsect2">
1571 <a name="g-static-private-set"></a><h3>g_static_private_set ()</h3>
1572 <pre class="programlisting"><span class="returnvalue">void</span>
1573 g_static_private_set (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> *private_key</code></em>,
1574 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>,
1575 <em class="parameter"><code><a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="type">GDestroyNotify</span></a> notify</code></em>);</pre>
1576 <div class="warning"><p><code class="literal">g_static_private_set</code> is deprecated and should not be used in newly-written code.</p></div>
1577 <p>Sets the pointer keyed to <em class="parameter"><code>private_key</code></em>
1578 for the current thread and
1579 the function <em class="parameter"><code>notify</code></em>
1580 to be called with that pointer (<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> or
1581 non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>), whenever the pointer is set again or whenever the
1582 current thread ends.</p>
1583 <p>This function works even if <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not yet been called.
1584 If <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> is called later, the <em class="parameter"><code>data</code></em>
1585 keyed to <em class="parameter"><code>private_key</code></em>
1587 will be inherited only by the main thread, i.e. the one that called
1588 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>.</p>
1589 <p><em class="parameter"><code>notify</code></em>
1590 is used quite differently from <em class="parameter"><code>destructor</code></em>
1591 in <a class="link" href="glib-Deprecated-Thread-APIs.html#g-private-new" title="g_private_new ()"><code class="function">g_private_new()</code></a>.</p>
1592 <div class="refsect3">
1593 <a name="g-static-private-set.parameters"></a><h4>Parameters</h4>
1594 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1596 <col width="150px" class="parameters_name">
1597 <col class="parameters_description">
1598 <col width="200px" class="parameters_annotations">
1602 <td class="parameter_name"><p>private_key</p></td>
1603 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a></p></td>
1604 <td class="parameter_annotations"> </td>
1607 <td class="parameter_name"><p>data</p></td>
1608 <td class="parameter_description"><p>the new pointer</p></td>
1609 <td class="parameter_annotations"> </td>
1612 <td class="parameter_name"><p>notify</p></td>
1613 <td class="parameter_description"><p>a function to be called with the pointer whenever the
1614 current thread ends or sets this pointer again</p></td>
1615 <td class="parameter_annotations"> </td>
1622 <div class="refsect2">
1623 <a name="g-static-private-free"></a><h3>g_static_private_free ()</h3>
1624 <pre class="programlisting"><span class="returnvalue">void</span>
1625 g_static_private_free (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> *private_key</code></em>);</pre>
1626 <div class="warning"><p><code class="literal">g_static_private_free</code> is deprecated and should not be used in newly-written code.</p></div>
1627 <p>Releases all resources allocated to <em class="parameter"><code>private_key</code></em>
1629 <p>You don't have to call this functions for a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> with an
1630 unbounded lifetime, i.e. objects declared 'static', but if you have
1631 a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> as a member of a structure and the structure is
1632 freed, you should also free the <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a>.</p>
1633 <div class="refsect3">
1634 <a name="g-static-private-free.parameters"></a><h4>Parameters</h4>
1635 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1637 <col width="150px" class="parameters_name">
1638 <col class="parameters_description">
1639 <col width="200px" class="parameters_annotations">
1642 <td class="parameter_name"><p>private_key</p></td>
1643 <td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> to be freed</p></td>
1644 <td class="parameter_annotations"> </td>
1650 <div class="refsect1">
1651 <a name="glib-Deprecated-Thread-APIs.other_details"></a><h2>Types and Values</h2>
1652 <div class="refsect2">
1653 <a name="G-THREADS-IMPL-POSIX:CAPS"></a><h3>G_THREADS_IMPL_POSIX</h3>
1654 <pre class="programlisting">#define G_THREADS_IMPL_POSIX
1656 <div class="warning">
1657 <p><code class="literal">G_THREADS_IMPL_POSIX</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
1658 <p>POSIX threads are in use on all non-Windows systems.
1659 Use G_OS_WIN32 to detect Windows.</p>
1661 <p>This macro is defined if POSIX style threads are used.</p>
1664 <div class="refsect2">
1665 <a name="G-THREADS-IMPL-WIN32:CAPS"></a><h3>G_THREADS_IMPL_WIN32</h3>
1666 <pre class="programlisting">#define G_THREADS_IMPL_NONE
1668 <div class="warning">
1669 <p><code class="literal">G_THREADS_IMPL_WIN32</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
1670 <p>Use G_OS_WIN32 to detect Windows.</p>
1672 <p>This macro is defined if Windows style threads are used.</p>
1675 <div class="refsect2">
1676 <a name="GThreadPriority"></a><h3>enum GThreadPriority</h3>
1677 <div class="warning">
1678 <p><code class="literal">GThreadPriority</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
1679 <p>Thread priorities no longer have any effect.</p>
1681 <p>Thread priorities.</p>
1682 <div class="refsect3">
1683 <a name="GThreadPriority.members"></a><h4>Members</h4>
1684 <div class="informaltable"><table class="informaltable" width="100%" border="0">
1686 <col width="300px" class="enum_members_name">
1687 <col class="enum_members_description">
1688 <col width="200px" class="enum_members_annotations">
1692 <td class="enum_member_name"><p><a name="G-THREAD-PRIORITY-LOW:CAPS"></a>G_THREAD_PRIORITY_LOW</p></td>
1693 <td class="enum_member_description">
1694 <p>a priority lower than normal</p>
1696 <td class="enum_member_annotations"> </td>
1699 <td class="enum_member_name"><p><a name="G-THREAD-PRIORITY-NORMAL:CAPS"></a>G_THREAD_PRIORITY_NORMAL</p></td>
1700 <td class="enum_member_description">
1701 <p>the default priority</p>
1703 <td class="enum_member_annotations"> </td>
1706 <td class="enum_member_name"><p><a name="G-THREAD-PRIORITY-HIGH:CAPS"></a>G_THREAD_PRIORITY_HIGH</p></td>
1707 <td class="enum_member_description">
1708 <p>a priority higher than normal</p>
1710 <td class="enum_member_annotations"> </td>
1713 <td class="enum_member_name"><p><a name="G-THREAD-PRIORITY-URGENT:CAPS"></a>G_THREAD_PRIORITY_URGENT</p></td>
1714 <td class="enum_member_description">
1715 <p>the highest priority</p>
1717 <td class="enum_member_annotations"> </td>
1724 <div class="refsect2">
1725 <a name="GStaticMutex"></a><h3>GStaticMutex</h3>
1726 <pre class="programlisting">typedef struct _GStaticMutex GStaticMutex;</pre>
1727 <p>A <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> works like a <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a>.</p>
1728 <p>Prior to GLib 2.32, GStaticMutex had the significant advantage
1729 that it doesn't need to be created at run-time, but can be defined
1730 at compile-time. Since 2.32, <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a> can be statically allocated
1731 as well, and GStaticMutex has been deprecated.</p>
1732 <p>Here is a version of our <code class="function">give_me_next_number()</code> example using
1734 <div class="informalexample">
1735 <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
1738 <td class="listing_lines" align="right"><pre>1
1751 <td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">int</span>
1752 <span class="function">give_me_next_number</span> <span class="gtkdoc opt">(</span><span class="gtkdoc kwb">void</span><span class="gtkdoc opt">)</span>
1753 <span class="gtkdoc opt">{</span>
1754 <span class="gtkdoc kwb">static int</span> current_number <span class="gtkdoc opt">=</span> <span class="number">0</span><span class="gtkdoc opt">;</span>
1755 <span class="gtkdoc kwb">int</span> ret_val<span class="gtkdoc opt">;</span>
1756 <span class="gtkdoc kwb">static</span> GStaticMutex mutex <span class="gtkdoc opt">=</span> G_STATIC_MUTEX_INIT<span class="gtkdoc opt">;</span>
1758 <span class="function"><a href="glib-Deprecated-Thread-APIs.html#g-static-mutex-lock">g_static_mutex_lock</a></span> <span class="gtkdoc opt">(&</span>mutex<span class="gtkdoc opt">);</span>
1759 ret_val <span class="gtkdoc opt">=</span> current_number <span class="gtkdoc opt">=</span> <span class="function">calc_next_number</span> <span class="gtkdoc opt">(</span>current_number<span class="gtkdoc opt">);</span>
1760 <span class="function"><a href="glib-Deprecated-Thread-APIs.html#g-static-mutex-unlock">g_static_mutex_unlock</a></span> <span class="gtkdoc opt">(&</span>mutex<span class="gtkdoc opt">);</span>
1762 <span class="keyword">return</span> ret_val<span class="gtkdoc opt">;</span>
1763 <span class="gtkdoc opt">}</span></pre></td>
1770 <p>Sometimes you would like to dynamically create a mutex. If you don't
1771 want to require prior calling to <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>, because your code
1772 should also be usable in non-threaded programs, you are not able to
1773 use <a class="link" href="glib-Deprecated-Thread-APIs.html#g-mutex-new" title="g_mutex_new ()"><code class="function">g_mutex_new()</code></a> and thus <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a>, as that requires a prior call to
1774 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>. In theses cases you can also use a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.
1775 It must be initialized with <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-init" title="g_static_mutex_init ()"><code class="function">g_static_mutex_init()</code></a> before using it
1776 and freed with with <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-free" title="g_static_mutex_free ()"><code class="function">g_static_mutex_free()</code></a> when not needed anymore to
1777 free up any allocated resources.</p>
1778 <p>Even though <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> is not opaque, it should only be used with
1779 the following functions, as it is defined differently on different
1781 <p>All of the g_static_mutex_* functions apart from
1782 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-get-mutex" title="g_static_mutex_get_mutex ()"><code class="function">g_static_mutex_get_mutex()</code></a> can also be used even if <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>
1783 has not yet been called. Then they do nothing, apart from
1784 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-trylock" title="g_static_mutex_trylock ()"><code class="function">g_static_mutex_trylock()</code></a> which does nothing but returning <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.</p>
1785 <p>All of the g_static_mutex_* functions are actually macros. Apart from
1786 taking their addresses, you can however use them as if they were
1790 <div class="refsect2">
1791 <a name="G-STATIC-MUTEX-INIT:CAPS"></a><h3>G_STATIC_MUTEX_INIT</h3>
1792 <pre class="programlisting">#define G_STATIC_MUTEX_INIT
1794 <div class="warning"><p><code class="literal">G_STATIC_MUTEX_INIT</code> is deprecated and should not be used in newly-written code.</p></div>
1795 <p>A <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> must be initialized with this macro, before it can
1796 be used. This macro can used be to initialize a variable, but it
1797 cannot be assigned to a variable. In that case you have to use
1798 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-init" title="g_static_mutex_init ()"><code class="function">g_static_mutex_init()</code></a>.</p>
1799 <div class="informalexample">
1800 <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
1803 <td class="listing_lines" align="right"><pre>1</pre></td>
1804 <td class="listing_code"><pre class="programlisting">GStaticMutex my_mutex <span class="gtkdoc opt">=</span> G_STATIC_MUTEX_INIT<span class="gtkdoc opt">;</span></pre></td>
1813 <div class="refsect2">
1814 <a name="GStaticRecMutex"></a><h3>struct GStaticRecMutex</h3>
1815 <pre class="programlisting">struct GStaticRecMutex {
1818 <div class="warning"><p><code class="literal">GStaticRecMutex</code> is deprecated and should not be used in newly-written code.</p></div>
1819 <p>A <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> works like a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>, but it can be locked
1820 multiple times by one thread. If you enter it n times, you have to
1821 unlock it n times again to let other threads lock it. An exception
1822 is the function <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-unlock-full" title="g_static_rec_mutex_unlock_full ()"><code class="function">g_static_rec_mutex_unlock_full()</code></a>: that allows you to
1823 unlock a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> completely returning the depth, (i.e. the
1824 number of times this mutex was locked). The depth can later be used
1825 to restore the state of the <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> by calling
1826 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-lock-full" title="g_static_rec_mutex_lock_full ()"><code class="function">g_static_rec_mutex_lock_full()</code></a>. In GLib 2.32, <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> has
1827 been deprecated in favor of <a class="link" href="glib-Threads.html#GRecMutex" title="struct GRecMutex"><span class="type">GRecMutex</span></a>.</p>
1828 <p>Even though <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> is not opaque, it should only be used
1829 with the following functions.</p>
1830 <p>All of the g_static_rec_mutex_* functions can be used even if
1831 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not been called. Then they do nothing, apart
1832 from <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-trylock" title="g_static_rec_mutex_trylock ()"><code class="function">g_static_rec_mutex_trylock()</code></a>, which does nothing but returning
1833 <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.</p>
1836 <div class="refsect2">
1837 <a name="G-STATIC-REC-MUTEX-INIT:CAPS"></a><h3>G_STATIC_REC_MUTEX_INIT</h3>
1838 <pre class="programlisting">#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT }
1840 <div class="warning"><p><code class="literal">G_STATIC_REC_MUTEX_INIT</code> is deprecated and should not be used in newly-written code.</p></div>
1841 <p>A <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> must be initialized with this macro before it can
1842 be used. This macro can used be to initialize a variable, but it
1843 cannot be assigned to a variable. In that case you have to use
1844 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-init" title="g_static_rec_mutex_init ()"><code class="function">g_static_rec_mutex_init()</code></a>.</p>
1845 <div class="informalexample">
1846 <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
1849 <td class="listing_lines" align="right"><pre>1</pre></td>
1850 <td class="listing_code"><pre class="programlisting">GStaticRecMutex my_mutex <span class="gtkdoc opt">=</span> G_STATIC_REC_MUTEX_INIT<span class="gtkdoc opt">;</span></pre></td>
1859 <div class="refsect2">
1860 <a name="GStaticRWLock"></a><h3>struct GStaticRWLock</h3>
1861 <pre class="programlisting">struct GStaticRWLock {
1864 <div class="warning">
1865 <p><code class="literal">GStaticRWLock</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
1866 <p>Use a <a class="link" href="glib-Threads.html#GRWLock" title="struct GRWLock"><span class="type">GRWLock</span></a> instead</p>
1868 <p>The <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> struct represents a read-write lock. A read-write
1869 lock can be used for protecting data that some portions of code only
1870 read from, while others also write. In such situations it is
1871 desirable that several readers can read at once, whereas of course
1872 only one writer may write at a time.</p>
1873 <p>Take a look at the following example:</p>
1874 <div class="informalexample">
1875 <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
1878 <td class="listing_lines" align="right"><pre>1
1911 <td class="listing_code"><pre class="programlisting">GStaticRWLock rwlock <span class="gtkdoc opt">=</span> G_STATIC_RW_LOCK_INIT<span class="gtkdoc opt">;</span>
1912 GPtrArray <span class="gtkdoc opt">*</span>array<span class="gtkdoc opt">;</span>
1915 <span class="function">my_array_get</span> <span class="gtkdoc opt">(</span>guint index<span class="gtkdoc opt">)</span>
1916 <span class="gtkdoc opt">{</span>
1917 gpointer retval <span class="gtkdoc opt">=</span> NULL<span class="gtkdoc opt">;</span>
1919 <span class="keyword">if</span> <span class="gtkdoc opt">(!</span>array<span class="gtkdoc opt">)</span>
1920 <span class="keyword">return</span> NULL<span class="gtkdoc opt">;</span>
1922 <span class="function"><a href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-lock">g_static_rw_lock_reader_lock</a></span> <span class="gtkdoc opt">(&</span>rwlock<span class="gtkdoc opt">);</span>
1923 <span class="keyword">if</span> <span class="gtkdoc opt">(</span>index <span class="gtkdoc opt"><</span> array<span class="gtkdoc opt">-></span>len<span class="gtkdoc opt">)</span>
1924 retval <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-Pointer-Arrays.html#g-ptr-array-index">g_ptr_array_index</a></span> <span class="gtkdoc opt">(</span>array<span class="gtkdoc opt">,</span> index<span class="gtkdoc opt">);</span>
1925 <span class="function"><a href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-unlock">g_static_rw_lock_reader_unlock</a></span> <span class="gtkdoc opt">(&</span>rwlock<span class="gtkdoc opt">);</span>
1927 <span class="keyword">return</span> retval<span class="gtkdoc opt">;</span>
1928 <span class="gtkdoc opt">}</span>
1930 <span class="gtkdoc kwb">void</span>
1931 <span class="function">my_array_set</span> <span class="gtkdoc opt">(</span>guint index<span class="gtkdoc opt">,</span> gpointer data<span class="gtkdoc opt">)</span>
1932 <span class="gtkdoc opt">{</span>
1933 <span class="function"><a href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-writer-lock">g_static_rw_lock_writer_lock</a></span> <span class="gtkdoc opt">(&</span>rwlock<span class="gtkdoc opt">);</span>
1935 <span class="keyword">if</span> <span class="gtkdoc opt">(!</span>array<span class="gtkdoc opt">)</span>
1936 array <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-Pointer-Arrays.html#g-ptr-array-new">g_ptr_array_new</a></span> <span class="gtkdoc opt">();</span>
1938 <span class="keyword">if</span> <span class="gtkdoc opt">(</span>index <span class="gtkdoc opt">>=</span> array<span class="gtkdoc opt">-></span>len<span class="gtkdoc opt">)</span>
1939 <span class="function"><a href="glib-Pointer-Arrays.html#g-ptr-array-set-size">g_ptr_array_set_size</a></span> <span class="gtkdoc opt">(</span>array<span class="gtkdoc opt">,</span> index <span class="gtkdoc opt">+</span> <span class="number">1</span><span class="gtkdoc opt">);</span>
1940 <span class="function"><a href="glib-Pointer-Arrays.html#g-ptr-array-index">g_ptr_array_index</a></span> <span class="gtkdoc opt">(</span>array<span class="gtkdoc opt">,</span> index<span class="gtkdoc opt">) =</span> data<span class="gtkdoc opt">;</span>
1942 <span class="function"><a href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-writer-unlock">g_static_rw_lock_writer_unlock</a></span> <span class="gtkdoc opt">(&</span>rwlock<span class="gtkdoc opt">);</span>
1943 <span class="gtkdoc opt">}</span></pre></td>
1950 <p>This example shows an array which can be accessed by many readers
1951 (the <code class="function">my_array_get()</code> function) simultaneously, whereas the writers
1952 (the <code class="function">my_array_set()</code> function) will only be allowed once at a time
1953 and only if no readers currently access the array. This is because
1954 of the potentially dangerous resizing of the array. Using these
1955 functions is fully multi-thread safe now.</p>
1956 <p>Most of the time, writers should have precedence over readers. That
1957 means, for this implementation, that as soon as a writer wants to
1958 lock the data, no other reader is allowed to lock the data, whereas,
1959 of course, the readers that already have locked the data are allowed
1960 to finish their operation. As soon as the last reader unlocks the
1961 data, the writer will lock it.</p>
1962 <p>Even though <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> is not opaque, it should only be used
1963 with the following functions.</p>
1964 <p>All of the g_static_rw_lock_* functions can be used even if
1965 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not been called. Then they do nothing, apart
1966 from g_static_rw_lock_*_trylock, which does nothing but returning <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.</p>
1967 <p>A read-write lock has a higher overhead than a mutex. For example, both
1968 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-lock" title="g_static_rw_lock_reader_lock ()"><code class="function">g_static_rw_lock_reader_lock()</code></a> and <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-unlock" title="g_static_rw_lock_reader_unlock ()"><code class="function">g_static_rw_lock_reader_unlock()</code></a> have
1969 to lock and unlock a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>, so it takes at least twice the time
1970 to lock and unlock a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> that it does to lock and unlock a
1971 <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>. So only data structures that are accessed by multiple
1972 readers, and which keep the lock for a considerable time justify a
1973 <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a>. The above example most probably would fare better with a
1974 <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p>
1977 <div class="refsect2">
1978 <a name="G-STATIC-RW-LOCK-INIT:CAPS"></a><h3>G_STATIC_RW_LOCK_INIT</h3>
1979 <pre class="programlisting">#define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, 0, 0 }
1981 <div class="warning"><p><code class="literal">G_STATIC_RW_LOCK_INIT</code> is deprecated and should not be used in newly-written code.</p></div>
1982 <p>A <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> must be initialized with this macro before it can
1983 be used. This macro can used be to initialize a variable, but it
1984 cannot be assigned to a variable. In that case you have to use
1985 <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-init" title="g_static_rw_lock_init ()"><code class="function">g_static_rw_lock_init()</code></a>.</p>
1986 <div class="informalexample">
1987 <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
1990 <td class="listing_lines" align="right"><pre>1</pre></td>
1991 <td class="listing_code"><pre class="programlisting">GStaticRWLock my_lock <span class="gtkdoc opt">=</span> G_STATIC_RW_LOCK_INIT<span class="gtkdoc opt">;</span></pre></td>
2000 <div class="refsect2">
2001 <a name="GStaticPrivate"></a><h3>struct GStaticPrivate</h3>
2002 <pre class="programlisting">struct GStaticPrivate {
2005 <div class="warning"><p><code class="literal">GStaticPrivate</code> is deprecated and should not be used in newly-written code.</p></div>
2006 <p>A <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> works almost like a <a class="link" href="glib-Threads.html#GPrivate" title="struct GPrivate"><span class="type">GPrivate</span></a>, but it has one
2007 significant advantage. It doesn't need to be created at run-time
2008 like a <a class="link" href="glib-Threads.html#GPrivate" title="struct GPrivate"><span class="type">GPrivate</span></a>, but can be defined at compile-time. This is
2009 similar to the difference between <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a> and <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p>
2010 <p>Now look at our <code class="function">give_me_next_number()</code> example with <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a>:</p>
2011 <div class="informalexample">
2012 <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
2015 <td class="listing_lines" align="right"><pre>1
2032 <td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">int</span>
2033 <span class="function">give_me_next_number</span> <span class="gtkdoc opt">()</span>
2034 <span class="gtkdoc opt">{</span>
2035 <span class="gtkdoc kwb">static</span> GStaticPrivate current_number_key <span class="gtkdoc opt">=</span> G_STATIC_PRIVATE_INIT<span class="gtkdoc opt">;</span>
2036 <span class="gtkdoc kwb">int</span> <span class="gtkdoc opt">*</span>current_number <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-Deprecated-Thread-APIs.html#g-static-private-get">g_static_private_get</a></span> <span class="gtkdoc opt">(&</span>current_number_key<span class="gtkdoc opt">);</span>
2038 <span class="keyword">if</span> <span class="gtkdoc opt">(!</span>current_number<span class="gtkdoc opt">)</span>
2039 <span class="gtkdoc opt">{</span>
2040 current_number <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-Memory-Allocation.html#g-new">g_new</a></span> <span class="gtkdoc opt">(</span><span class="gtkdoc kwb">int</span><span class="gtkdoc opt">,</span> <span class="number">1</span><span class="gtkdoc opt">);</span>
2041 <span class="gtkdoc opt">*</span>current_number <span class="gtkdoc opt">=</span> <span class="number">0</span><span class="gtkdoc opt">;</span>
2042 <span class="function"><a href="glib-Deprecated-Thread-APIs.html#g-static-private-set">g_static_private_set</a></span> <span class="gtkdoc opt">(&</span>current_number_key<span class="gtkdoc opt">,</span> current_number<span class="gtkdoc opt">,</span> g_free<span class="gtkdoc opt">);</span>
2043 <span class="gtkdoc opt">}</span>
2045 <span class="gtkdoc opt">*</span>current_number <span class="gtkdoc opt">=</span> <span class="function">calc_next_number</span> <span class="gtkdoc opt">(*</span>current_number<span class="gtkdoc opt">);</span>
2047 <span class="keyword">return</span> <span class="gtkdoc opt">*</span>current_number<span class="gtkdoc opt">;</span>
2048 <span class="gtkdoc opt">}</span></pre></td>
2057 <div class="refsect2">
2058 <a name="G-STATIC-PRIVATE-INIT:CAPS"></a><h3>G_STATIC_PRIVATE_INIT</h3>
2059 <pre class="programlisting">#define G_STATIC_PRIVATE_INIT
2061 <div class="warning"><p><code class="literal">G_STATIC_PRIVATE_INIT</code> is deprecated and should not be used in newly-written code.</p></div>
2062 <p>Every <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> must be initialized with this macro, before it
2064 <div class="informalexample">
2065 <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
2068 <td class="listing_lines" align="right"><pre>1</pre></td>
2069 <td class="listing_code"><pre class="programlisting">GStaticPrivate my_private <span class="gtkdoc opt">=</span> G_STATIC_PRIVATE_INIT<span class="gtkdoc opt">;</span></pre></td>
2078 <div class="refsect1">
2079 <a name="glib-Deprecated-Thread-APIs.see-also"></a><h2>See Also</h2>
2080 <p><a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a></p>
2083 <div class="footer">
2084 <hr>Generated by GTK-Doc V1.25.1</div>