[glib/wip/mutexes: 58/58] Move some things to deprecated/gthread.h
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/mutexes: 58/58] Move some things to deprecated/gthread.h
- Date: Mon, 19 Sep 2011 05:16:57 +0000 (UTC)
commit ea4d5dade61b50c70057ecb2ed46c5c89273eafd
Author: Ryan Lortie <desrt desrt ca>
Date: Mon Sep 19 01:11:11 2011 -0400
Move some things to deprecated/gthread.h
glib/Makefile.am | 3 +-
glib/deprecated/gthread.h | 112 +++++++++++++++++++++++++++++++++++++++++++++
glib/glib.h | 1 +
glib/gthread.c | 2 +-
glib/gthread.h | 83 +--------------------------------
5 files changed, 118 insertions(+), 83 deletions(-)
---
diff --git a/glib/Makefile.am b/glib/Makefile.am
index d24bb87..7d11f45 100644
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -114,7 +114,8 @@ uninstall-ms-lib:
deprecated_sources = \
deprecated/gallocator.c \
deprecated/gcompletion.c \
- deprecated/grel.c
+ deprecated/grel.c \
+ deprecated/gthread.h
libglib_2_0_la_SOURCES = \
$(deprecated_sources) \
diff --git a/glib/deprecated/gthread.h b/glib/deprecated/gthread.h
new file mode 100644
index 0000000..4425de1
--- /dev/null
+++ b/glib/deprecated/gthread.h
@@ -0,0 +1,112 @@
+/* GLIB - Library of useful routines for C programming
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
+ * file for a list of people on the GLib Team. See the ChangeLog
+ * files for a list of changes. These files are distributed with
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ */
+
+#if defined(G_DISABLE_SINGLE_INCLUDES) && !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
+#error "Only <glib.h> can be included directly."
+#endif
+
+#ifndef __G_DEPRECATED_THREAD_H__
+#define __G_DEPRECATED_THREAD_H__
+
+#include <glib/gthread.h>
+
+G_BEGIN_DECLS
+
+typedef enum
+{
+ G_THREAD_PRIORITY_LOW,
+ G_THREAD_PRIORITY_NORMAL,
+ G_THREAD_PRIORITY_HIGH,
+ G_THREAD_PRIORITY_URGENT
+} GThreadPriority;
+
+struct _GThread
+{
+ /*< private >*/
+ GThreadFunc func;
+ gpointer data;
+ gboolean joinable;
+ GThreadPriority priority;
+};
+
+typedef struct _GThreadFunctions GThreadFunctions;
+struct _GThreadFunctions
+{
+ GMutex* (*mutex_new) (void);
+ void (*mutex_lock) (GMutex *mutex);
+ gboolean (*mutex_trylock) (GMutex *mutex);
+ void (*mutex_unlock) (GMutex *mutex);
+ void (*mutex_free) (GMutex *mutex);
+ GCond* (*cond_new) (void);
+ void (*cond_signal) (GCond *cond);
+ void (*cond_broadcast) (GCond *cond);
+ void (*cond_wait) (GCond *cond,
+ GMutex *mutex);
+ gboolean (*cond_timed_wait) (GCond *cond,
+ GMutex *mutex,
+ GTimeVal *end_time);
+ void (*cond_free) (GCond *cond);
+ GPrivate* (*private_new) (GDestroyNotify destructor);
+ gpointer (*private_get) (GPrivate *private_key);
+ void (*private_set) (GPrivate *private_key,
+ gpointer data);
+ void (*thread_create) (GThreadFunc func,
+ gpointer data,
+ gulong stack_size,
+ gboolean joinable,
+ gboolean bound,
+ GThreadPriority priority,
+ gpointer thread,
+ GError **error);
+ void (*thread_yield) (void);
+ void (*thread_join) (gpointer thread);
+ void (*thread_exit) (void);
+ void (*thread_set_priority)(gpointer thread,
+ GThreadPriority priority);
+ void (*thread_self) (gpointer thread);
+ gboolean (*thread_equal) (gpointer thread1,
+ gpointer thread2);
+};
+
+GLIB_VAR GThreadFunctions g_thread_functions_for_glib_use;
+GLIB_VAR gboolean g_thread_use_default_impl;
+
+GLIB_VAR guint64 (*g_thread_gettime) (void);
+
+/* internal function for fallback static mutex implementation */
+GMutex* g_static_mutex_get_mutex_impl (GMutex **mutex);
+
+GThread* g_thread_create_full (GThreadFunc func,
+ gpointer data,
+ gulong stack_size,
+ gboolean joinable,
+ gboolean bound,
+ GThreadPriority priority,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __G_DEPRECATED_THREAD_H__ */
diff --git a/glib/glib.h b/glib/glib.h
index 0831119..2ca19d2 100644
--- a/glib/glib.h
+++ b/glib/glib.h
@@ -97,6 +97,7 @@
#include <glib/deprecated/gallocator.h>
#include <glib/deprecated/gcompletion.h>
#include <glib/deprecated/grel.h>
+#include <glib/deprecated/gthread.h>
#endif
#undef __GLIB_H_INSIDE__
diff --git a/glib/gthread.c b/glib/gthread.c
index 7a3248a..213540d 100644
--- a/glib/gthread.c
+++ b/glib/gthread.c
@@ -40,7 +40,7 @@
#include "config.h"
-#include "gthread.h"
+#include "deprecated/gthread.h"
#include "gthreadprivate.h"
#include "gmain.h"
diff --git a/glib/gthread.h b/glib/gthread.h
index 928fb99..45b0cc7 100644
--- a/glib/gthread.h
+++ b/glib/gthread.h
@@ -50,26 +50,7 @@ typedef enum
typedef gpointer (*GThreadFunc) (gpointer data);
-/* This is "deprecated", but we can't actually remove it since
- * g_thread_create_full takes it.
- */
-typedef enum
-{
- G_THREAD_PRIORITY_LOW,
- G_THREAD_PRIORITY_NORMAL,
- G_THREAD_PRIORITY_HIGH,
- G_THREAD_PRIORITY_URGENT
-} GThreadPriority;
-
typedef struct _GThread GThread;
-struct _GThread
-{
- /*< private >*/
- GThreadFunc func;
- gpointer data;
- gboolean joinable;
- GThreadPriority priority;
-};
typedef struct _GMutex GMutex;
typedef struct _GCond GCond;
@@ -107,53 +88,6 @@ struct _GCond
#endif
-typedef struct _GThreadFunctions GThreadFunctions;
-struct _GThreadFunctions
-{
- GMutex* (*mutex_new) (void);
- void (*mutex_lock) (GMutex *mutex);
- gboolean (*mutex_trylock) (GMutex *mutex);
- void (*mutex_unlock) (GMutex *mutex);
- void (*mutex_free) (GMutex *mutex);
- GCond* (*cond_new) (void);
- void (*cond_signal) (GCond *cond);
- void (*cond_broadcast) (GCond *cond);
- void (*cond_wait) (GCond *cond,
- GMutex *mutex);
- gboolean (*cond_timed_wait) (GCond *cond,
- GMutex *mutex,
- GTimeVal *end_time);
- void (*cond_free) (GCond *cond);
- GPrivate* (*private_new) (GDestroyNotify destructor);
- gpointer (*private_get) (GPrivate *private_key);
- void (*private_set) (GPrivate *private_key,
- gpointer data);
- void (*thread_create) (GThreadFunc func,
- gpointer data,
- gulong stack_size,
- gboolean joinable,
- gboolean bound,
- GThreadPriority priority,
- gpointer thread,
- GError **error);
- void (*thread_yield) (void);
- void (*thread_join) (gpointer thread);
- void (*thread_exit) (void);
- void (*thread_set_priority)(gpointer thread,
- GThreadPriority priority);
- void (*thread_self) (gpointer thread);
- gboolean (*thread_equal) (gpointer thread1,
- gpointer thread2);
-};
-
-GLIB_VAR GThreadFunctions g_thread_functions_for_glib_use;
-GLIB_VAR gboolean g_thread_use_default_impl;
-GLIB_VAR gboolean g_threads_got_initialized;
-
-#ifndef G_DISABLE_DEPRECATED
-GLIB_VAR guint64 (*g_thread_gettime) (void);
-#endif
-
/* initializes the mutex/cond/private implementation for glib, might
* only be called once, and must not be called directly or indirectly
* from another glib-function, e.g. as a callback.
@@ -165,6 +99,8 @@ void g_thread_init (gpointer vtable);
*/
gboolean g_thread_get_initialized (void);
+GLIB_VAR gboolean g_threads_got_initialized;
+
/* internal function for fallback static mutex implementation */
GMutex* g_static_mutex_get_mutex_impl (GMutex **mutex);
@@ -174,16 +110,6 @@ GMutex* g_static_mutex_get_mutex_impl (GMutex **mutex);
#define g_thread_supported() (g_threads_got_initialized)
#endif
-#ifndef G_DISABLE_DEPRECATED
-GThread* g_thread_create_full (GThreadFunc func,
- gpointer data,
- gulong stack_size,
- gboolean joinable,
- gboolean bound,
- GThreadPriority priority,
- GError **error);
-#endif
-
GThread * g_thread_create (GThreadFunc func,
gpointer data,
gboolean joinable,
@@ -200,11 +126,6 @@ void g_thread_exit (gpointer retval);
gpointer g_thread_join (GThread *thread);
void g_thread_yield (void);
-#ifndef G_DISABLE_DEPRECATED
-void g_thread_set_priority (GThread *thread,
- GThreadPriority priority);
-#endif
-
#ifdef G_OS_WIN32
typedef GMutex * GStaticMutex;
#define G_STATIC_MUTEX_INIT NULL
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]