After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 793124 - Remove gdk_threads_* API
Remove gdk_threads_* API
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2018-02-02 16:08 UTC by Emmanuele Bassi (:ebassi)
Modified: 2018-02-05 14:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Replace gdk_threads_add_idle* with g_idle_add() (17.60 KB, patch)
2018-02-02 16:09 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
Replace gdk_threads_add_timeout* with g_timeout_add() (54.21 KB, patch)
2018-02-02 16:09 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
Drop the Big GDK Lock (29.38 KB, patch)
2018-02-02 16:09 UTC, Emmanuele Bassi (:ebassi)
none Details | Review
Remove all gdk_threads_* entry points (19.22 KB, patch)
2018-02-02 16:10 UTC, Emmanuele Bassi (:ebassi)
none Details | Review

Description Emmanuele Bassi (:ebassi) 2018-02-02 16:08:36 UTC
- The API to mark critical sections is deprecated.
 - Marking critical sections is not portable
 - We only ever guaranteed that GTK works from a single thread

Now that we're bumping API, it's time to let this old API go.

Branch: https://git.gnome.org/browse/gtk+/log/?h=wip/no-more-gdk-threads
Comment 1 Emmanuele Bassi (:ebassi) 2018-02-02 16:09:45 UTC
Created attachment 367826 [details] [review]
Replace gdk_threads_add_idle* with g_idle_add()

The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_idle() and
gdk_threads_add_idle_full() exist is to allow invoking a callback with
the GDK lock held, in case 3rd party libraries still use the deprecated
gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing idle callbacks.
Comment 2 Emmanuele Bassi (:ebassi) 2018-02-02 16:09:51 UTC
Created attachment 367827 [details] [review]
Replace gdk_threads_add_timeout* with g_timeout_add()

The main GDK thread lock is not portable and deprecated.

The only reason why gdk_threads_add_timeout() and
gdk_threads_add_timeout_full() exist is to allow invoking a callback
with the GDK lock held, in case 3rd party libraries still use the
deprecated gdk_threads_enter()/gdk_threads_leave() API.

Since we're removing the GDK lock, and we're releasing a new major API,
such code cannot exist any more; this means we can use the GLib API for
installing timeout callbacks.
Comment 3 Emmanuele Bassi (:ebassi) 2018-02-02 16:09:58 UTC
Created attachment 367828 [details] [review]
Drop the Big GDK Lock

GDK has a lock to mark critical sections inside the backends.
Additionally, code that would re-enter into the GTK main loop was
supposed to hold the lock.

Back in the Good Old Days™ this was guaranteed to kind of work only on
the X11 backend, and would cause a neat explosion on any other GDK
backend.

During GTK+ 3.x we deprecated the API to enter and leave the critical
sections, and now we can remove all the internal uses of the lock, since
external API that uses GTK+ 4.x won't be able to hold the GDK lock.
Comment 4 Emmanuele Bassi (:ebassi) 2018-02-02 16:10:04 UTC
Created attachment 367829 [details] [review]
Remove all gdk_threads_* entry points

Now that we don't use them anywhere, it's time for them to go.
Comment 5 Matthias Clasen 2018-02-03 08:15:13 UTC
Looks all good to me.
Comment 6 Emmanuele Bassi (:ebassi) 2018-02-05 14:27:06 UTC
The branch was merged into master.