mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 05:01:09 +00:00
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
This commit is contained in:
parent
746b9d7c41
commit
0ac56e9dcc
12
gdk/gdk.c
12
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
|
||||
|
@ -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__ */
|
||||
|
Loading…
Reference in New Issue
Block a user