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 726318 - gio: Document that GSocket is not thread safe
gio: Document that GSocket is not thread safe
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gio
unspecified
Other All
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2014-03-14 10:24 UTC by Philip Withnall
Modified: 2014-04-17 06:53 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gio: Document that GSocket is not thread safe (788 bytes, patch)
2014-03-14 10:24 UTC, Philip Withnall
none Details | Review
gio: Document that GSocket is not thread safe (824 bytes, patch)
2014-04-16 18:04 UTC, Philip Withnall
committed Details | Review

Description Philip Withnall 2014-03-14 10:24:46 UTC
Patch attached.
Comment 1 Philip Withnall 2014-03-14 10:24:48 UTC
Created attachment 271851 [details] [review]
gio: Document that GSocket is not thread safe
Comment 2 Matthias Clasen 2014-03-14 15:01:15 UTC
No.

Nothing in glib or gio is threadsafe unless it is explicitly documented as such. Add such information in random places will only confuse people about this fact.
Comment 3 Philip Withnall 2014-03-14 15:26:48 UTC
(In reply to comment #2)
> Nothing in glib or gio is threadsafe unless it is explicitly documented as
> such. Add such information in random places will only confuse people about this
> fact.

I would argue that send()/recv() are atomic, so people might reasonably think that the low-level GSocket API is also atomic. I certainly did, but I seem to make mistakes like this with annoying frequency.

Perhaps I could reword the docs addition to say ‘Like the rest of GLib, GSocket is not thread safe…’?
Comment 4 Dan Winship 2014-03-16 02:03:47 UTC
People seem to expect GSocket to be thread-safe more often than they do other classes (eg, bug 705027).
Comment 5 Philip Withnall 2014-04-16 15:25:38 UTC
(In reply to comment #3)
> Perhaps I could reword the docs addition to say ‘Like the rest of GLib, GSocket
> is not thread safe…’?

Matthias, what do you think?
Comment 6 Matthias Clasen 2014-04-16 16:32:09 UTC
Now, that is not entirely accurate either. _Some_ parts of GLib _are_ explicitly thread safe.
Comment 7 Philip Withnall 2014-04-16 18:01:23 UTC
(In reply to comment #6)
> Now, that is not entirely accurate either. _Some_ parts of GLib _are_
> explicitly thread safe.

Fair point. Which approach would you like? What you suggest, or the existing patch?
Comment 8 Philip Withnall 2014-04-16 18:04:29 UTC
Created attachment 274506 [details] [review]
gio: Document that GSocket is not thread safe
Comment 9 Matthias Clasen 2014-04-16 23:22:43 UTC
this one is factually correct, so lets go with it
Comment 10 Philip Withnall 2014-04-17 06:53:26 UTC
Attachment 274506 [details] pushed as 2b247e1 - gio: Document that GSocket is not thread safe