summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2012-07-28 17:23:17 +0200
committerMatthias Clasen <mclasen@redhat.com>2012-07-30 18:01:47 +0200
commit0ac56e9dcc526d07975feeb1a297640a8452525b (patch)
tree8361203874819948489af4780b3661a6b29c18de /gdk
parent746b9d7c414884ec68ee46865f58a31afa072ce2 (diff)
downloadgtk+-0ac56e9dcc526d07975feeb1a297640a8452525b.tar.gz
gdk: Deprecate thread functions
This commit deprecates gdk_threads_init, gdk_threads_enter, gdk_threads_leave and gdk_threads_set_lock_functions. Using GTK+ from multiple threads does not work at all on Windows, and is problematic on other platforms as well. We want to move to a world where all GTK+ calls are made from the main thread. Use g_main_context_invoke, g_idle_add and related functions if you need to schedule GTK+ calls from other threads. http://bugzilla.gnome.org/show_bug.cgi?id=680754
Diffstat (limited to 'gdk')
-rw-r--r--gdk/gdk.c12
-rw-r--r--gdk/gdkthreads.h22
2 files changed, 34 insertions, 0 deletions
diff --git a/gdk/gdk.c b/gdk/gdk.c
index 3c8c71153b..cf81863a1d 100644
--- a/gdk/gdk.c
+++ b/gdk/gdk.c
@@ -663,6 +663,9 @@ gdk_init (int *argc, char ***argv)
* GDK and GTK+ functions can be called safely and without causing race
* conditions. Only one thread at a time can be in such a critial
* section.
+ *
+ * Deprecated:3.6: All GDK and GTK+ calls should be made from the main
+ * thread
*/
void
gdk_threads_enter (void)
@@ -675,6 +678,9 @@ gdk_threads_enter (void)
* gdk_threads_leave:
*
* Leaves a critical region begun with gdk_threads_enter().
+ *
+ * Deprecated:3.6: All GDK and GTK+ calls should be made from the main
+ * thread
*/
void
gdk_threads_leave (void)
@@ -703,6 +709,9 @@ gdk_threads_impl_unlock (void)
*
* This call must be made before any use of the main loop from
* GTK+; to be safe, call it before gtk_init().
+ *
+ * Deprecated:3.6: All GDK and GTK+ calls should be made from the main
+ * thread
*/
void
gdk_threads_init (void)
@@ -740,6 +749,9 @@ gdk_threads_init (void)
* This method must be called before gdk_threads_init(), and cannot
* be called multiple times.
*
+ * Deprecated:3.6: All GDK and GTK+ calls should be made from the main
+ * thread
+ *
* Since: 2.4
**/
void
diff --git a/gdk/gdkthreads.h b/gdk/gdkthreads.h
index 74e48992cd..172e1b1657 100644
--- a/gdk/gdkthreads.h
+++ b/gdk/gdkthreads.h
@@ -33,9 +33,19 @@
G_BEGIN_DECLS
+#if defined(GDK_COMPILATION) || defined(GTK_COMPILATION)
+#define GDK_THREADS_DEPRECATED
+#else
+#define GDK_THREADS_DEPRECATED GDK_DEPRECATED_IN_3_6
+#endif
+
+GDK_THREADS_DEPRECATED
void gdk_threads_init (void);
+GDK_THREADS_DEPRECATED
void gdk_threads_enter (void);
+GDK_THREADS_DEPRECATED
void gdk_threads_leave (void);
+GDK_THREADS_DEPRECATED
void gdk_threads_set_lock_functions (GCallback enter_fn,
GCallback leave_fn);
@@ -62,6 +72,9 @@ guint gdk_threads_add_timeout_seconds (guint interval,
GSourceFunc function,
gpointer data);
+
+#if !(GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_6)
+
/**
* GDK_THREADS_ENTER:
*
@@ -71,6 +84,9 @@ guint gdk_threads_add_timeout_seconds (guint interval,
* section. The macro expands to a no-op if #G_THREADS_ENABLED has not
* been defined. Typically gdk_threads_enter() should be used instead of
* this macro.
+ *
+ * Deprecated:3.6: Use g_main_context_invoke(), g_idle_add() and related
+ * functions if you need to schedule GTK+ calls from other threads.
*/
#define GDK_THREADS_ENTER() gdk_threads_enter()
@@ -79,9 +95,15 @@ guint gdk_threads_add_timeout_seconds (guint interval,
*
* This macro marks the end of a critical section
* begun with #GDK_THREADS_ENTER.
+ *
+ * Deprecated:3.6: Deprecated in 3.6.
*/
#define GDK_THREADS_LEAVE() gdk_threads_leave()
+#endif
+
+#undef GDK_THREADS_DEPRECATED
+
G_END_DECLS
#endif /* __GDK_THREADS_H__ */