- * Deprecated: 2.32: Use g_mutex_lock()
- */
-
-/**
- * g_static_mutex_trylock:
- * @mutex: a #GStaticMutex.
- * @Returns: %TRUE, if the #GStaticMutex could be locked.
- *
- * Works like g_mutex_trylock(), but for a #GStaticMutex.
- *
- * Deprecated: 2.32: Use g_mutex_trylock()
- */
-
-/**
- * g_static_mutex_unlock:
- * @mutex: a #GStaticMutex.
- *
- * Works like g_mutex_unlock(), but for a #GStaticMutex.
- *
- * Deprecated: 2.32: Use g_mutex_unlock()
- */
-
-/**
- * g_static_mutex_free:
- * @mutex: a #GStaticMutex to be freed.
- *
- * Releases all resources allocated to @mutex.
- *
- * You don't have to call this functions for a #GStaticMutex with an
- * unbounded lifetime, i.e. objects declared 'static', but if you have
- * a #GStaticMutex as a member of a structure and the structure is
- * freed, you should also free the #GStaticMutex.
- *
- * <note><para>Calling g_static_mutex_free() on a locked mutex may
- * result in undefined behaviour.</para></note>
- *
- * Deprecated: 2.32: Use g_mutex_free()
- */
-void
-g_static_mutex_free (GStaticMutex* mutex)
-{
- GMutex **runtime_mutex;
-
- g_return_if_fail (mutex);
-
- /* The runtime_mutex is the first (or only) member of GStaticMutex,
- * see both versions (of glibconfig.h) in configure.ac. Note, that
- * this variable is NULL, if g_thread_init() hasn't been called or
- * if we're using the default thread implementation and it provides
- * static mutexes. */
- runtime_mutex = ((GMutex**)mutex);
-
- if (*runtime_mutex)
- g_mutex_free (*runtime_mutex);
-
- *runtime_mutex = NULL;
-}
-
-/* ------------------------------------------------------------------------ */
-
-/**
- * GStaticRecMutex:
- *
- * A #GStaticRecMutex works like a #GStaticMutex, but it can be locked
- * multiple times by one thread. If you enter it n times, you have to
- * unlock it n times again to let other threads lock it. An exception
- * is the function g_static_rec_mutex_unlock_full(): that allows you to
- * unlock a #GStaticRecMutex completely returning the depth, (i.e. the
- * number of times this mutex was locked). The depth can later be used
- * to restore the state of the #GStaticRecMutex by calling
- * g_static_rec_mutex_lock_full(). In GLib 2.32, #GStaticRecMutex has
- * been deprecated in favor of #GRecMutex.
- *
- * Even though #GStaticRecMutex is not opaque, it should only be used
- * with the following functions.
- *
- * All of the <function>g_static_rec_mutex_*</function> functions can
- * be used even if g_thread_init() has not been called. Then they do
- * nothing, apart from <function>g_static_rec_mutex_trylock</function>,
- * which does nothing but returning %TRUE.
- **/
-
-/**
- * G_STATIC_REC_MUTEX_INIT:
- *
- * A #GStaticRecMutex must be initialized with this macro before it can
- * be used. This macro can used be to initialize a variable, but it
- * cannot be assigned to a variable. In that case you have to use
- * g_static_rec_mutex_init().
- *
- * |[
- * GStaticRecMutex my_mutex = G_STATIC_REC_MUTEX_INIT;
- * ]|
- */
-
-/**
- * g_static_rec_mutex_init:
- * @mutex: a #GStaticRecMutex to be initialized.
- *
- * A #GStaticRecMutex must be initialized with this function before it
- * can be used. Alternatively you can initialize it with
- * #G_STATIC_REC_MUTEX_INIT.
- *
- * Deprecated: 2.32: Use g_rec_mutex_init()
- */
-void
-g_static_rec_mutex_init (GStaticRecMutex *mutex)
-{
- static const GStaticRecMutex init_mutex = G_STATIC_REC_MUTEX_INIT;
-
- g_return_if_fail (mutex);
-
- *mutex = init_mutex;
-}
-
-/**
- * g_static_rec_mutex_lock:
- * @mutex: a #GStaticRecMutex to lock.
- *
- * Locks @mutex. If @mutex is already locked by another thread, the
- * current thread will block until @mutex is unlocked by the other
- * thread. If @mutex is already locked by the calling thread, this
- * functions increases the depth of @mutex and returns immediately.
- *
- * Deprecated: 2.32: Use g_rec_mutex_lock()
- */
-void
-g_static_rec_mutex_lock (GStaticRecMutex* mutex)
-{
- GSystemThread self;
-
- g_return_if_fail (mutex);
-
- if (!g_thread_supported ())
- return;
-
- g_system_thread_self (&self);
-
- if (g_system_thread_equal (&self, &mutex->owner))
- {
- mutex->depth++;
- return;
- }
- g_static_mutex_lock (&mutex->mutex);
- g_system_thread_assign (mutex->owner, self);
- mutex->depth = 1;
-}
-
-/**
- * g_static_rec_mutex_trylock:
- * @mutex: a #GStaticRecMutex to lock.
- * @Returns: %TRUE, if @mutex could be locked.
- *
- * Tries to lock @mutex. If @mutex is already locked by another thread,
- * it immediately returns %FALSE. Otherwise it locks @mutex and returns
- * %TRUE. If @mutex is already locked by the calling thread, this
- * functions increases the depth of @mutex and immediately returns
- * %TRUE.
- *
- * Deprecated: 2.32: Use g_rec_mutex_trylock()
- */
-gboolean
-g_static_rec_mutex_trylock (GStaticRecMutex* mutex)
-{
- GSystemThread self;
-
- g_return_val_if_fail (mutex, FALSE);
-
- if (!g_thread_supported ())
- return TRUE;
-
- g_system_thread_self (&self);
-
- if (g_system_thread_equal (&self, &mutex->owner))
- {
- mutex->depth++;
- return TRUE;
- }
-
- if (!g_static_mutex_trylock (&mutex->mutex))
- return FALSE;
-
- g_system_thread_assign (mutex->owner, self);
- mutex->depth = 1;
- return TRUE;
-}
-
-/**
- * g_static_rec_mutex_unlock:
- * @mutex: a #GStaticRecMutex to unlock.
- *
- * Unlocks @mutex. Another thread will be allowed to lock @mutex only
- * when it has been unlocked as many times as it had been locked
- * before. If @mutex is completely unlocked and another thread is
- * blocked in a g_static_rec_mutex_lock() call for @mutex, it will be
- * woken and can lock @mutex itself.
- *
- * Deprecated: 2.32: Use g_rec_mutex_unlock()
- */
-void
-g_static_rec_mutex_unlock (GStaticRecMutex* mutex)
-{
- g_return_if_fail (mutex);
-
- if (!g_thread_supported ())
- return;
-
- if (mutex->depth > 1)
- {
- mutex->depth--;
- return;
- }
- g_system_thread_assign (mutex->owner, zero_thread);
- g_static_mutex_unlock (&mutex->mutex);
-}
-
-/**
- * g_static_rec_mutex_lock_full:
- * @mutex: a #GStaticRecMutex to lock.
- * @depth: number of times this mutex has to be unlocked to be
- * completely unlocked.
- *
- * Works like calling g_static_rec_mutex_lock() for @mutex @depth times.
- *
- * Deprecated: 2.32: Use g_rec_mutex_lock()
- */
-void
-g_static_rec_mutex_lock_full (GStaticRecMutex *mutex,
- guint depth)
-{
- GSystemThread self;
- g_return_if_fail (mutex);
-
- if (!g_thread_supported ())
- return;
-
- if (depth == 0)
- return;
-
- g_system_thread_self (&self);
-
- if (g_system_thread_equal (&self, &mutex->owner))
- {
- mutex->depth += depth;
- return;
- }
- g_static_mutex_lock (&mutex->mutex);
- g_system_thread_assign (mutex->owner, self);
- mutex->depth = depth;
-}
-
-/**
- * g_static_rec_mutex_unlock_full:
- * @mutex: a #GStaticRecMutex to completely unlock.
- * @Returns: number of times @mutex has been locked by the current
- * thread.
- *
- * Completely unlocks @mutex. If another thread is blocked in a
- * g_static_rec_mutex_lock() call for @mutex, it will be woken and can
- * lock @mutex itself. This function returns the number of times that
- * @mutex has been locked by the current thread. To restore the state
- * before the call to g_static_rec_mutex_unlock_full() you can call
- * g_static_rec_mutex_lock_full() with the depth returned by this
- * function.
- *
- * Deprecated: 2.32: Use g_rec_mutex_unlock()
- */
-guint
-g_static_rec_mutex_unlock_full (GStaticRecMutex *mutex)
-{
- guint depth;
-
- g_return_val_if_fail (mutex, 0);
-
- if (!g_thread_supported ())
- return 1;
-
- depth = mutex->depth;
-
- g_system_thread_assign (mutex->owner, zero_thread);
- mutex->depth = 0;
- g_static_mutex_unlock (&mutex->mutex);
-
- return depth;
-}
-
-/**
- * g_static_rec_mutex_free:
- * @mutex: a #GStaticRecMutex to be freed.