GDBusConnection: make the closed flag atomic (but still lock to write)
GDBusConnection: make the closed flag atomic (but still lock to write)

Strictly speaking, neither of the two uses that aren't under the lock
*needs* to be atomic, but it seems better to be obviously correct (and
we save another 4 bytes of struct).

One of these uses is in g_dbus_connection_is_closed(), any use of which
is inherently a race condition anyway.

The other is g_dbus_connection_flush_sync, which as far as I can tell
just needs a best-effort check, to not waste effort on a connection that
has been closed for a while (but I could be wrong).

I removed the check for the closed flag altogether in
g_dbus_connection_send_message_with_reply_unlocked, because it turns out
to be redundant with one in g_dbus_connection_send_message_unlocked,
which is called immediately after.

g_dbus_connection_close_sync held the lock to check the closed flag,
which is no longer needed.

As far as I can tell, the only reason why the lock is still desirable
when setting the closed flag is so that remove_match_rule can't fail
by racing with close notification from the worker thread - but
on_worker_closed needs to hold the lock anyway, to deal with other
data structures, so there's no point in trying to eliminate the
requirement to hold the lock.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=661992
Signed-off-by: Simon McVittie <2b470b34502dbf3ba4bcc04ea7e64f4e0e104f33@collabora.co.uk>
Reviewed-by: David Zeuthen <16a4bae6a7afea1fdd75baca6404fe68f285db96@redhat.com>

djdeath/glib,cosimoc/glib,lukasz-skalski/glib,krichter722/glib,01org/android-bluez-glib,endlessm/glib,tchakabam/glib,mzabaluev/glib,endlessm/glib,tchakabam/glib,mzabaluev/glib,gale320/glib,tamaskenez/glib,cention-sany/glib,bluez-android/glib,mzabaluev/glib,ieei/glib,cosimoc/glib,antono/glib,mzabaluev/glib,pstglia/external-bluetooth-glib,darren-clark/android_platform_external_bluetooth_glib,antono/glib,djdeath/glib,johne53/MB3Glib,bluez-android/glib,lukasz-skalski/glib,Distrotech/glib,johne53/MB3Glib,krichter722/glib,iConsole/Console-OS_external_bluetooth_glib,antono/glib,pstglia/platform-external-bluetooth-glib,gale320/glib,lukasz-skalski/glib,djdeath/glib,johne53/MB3Glib,djdeath/glib,endlessm/glib,ieei/glib,darren-clark/android_platform_external_bluetooth_glib,bluez-android/glib,justinkb/aosp-bluez.glib,gale320/glib,krichter722/glib,Distrotech/glib,pstglia/platform-external-bluetooth-glib,pstglia/external-bluetooth-glib,ieei/glib,antono/glib,tchakabam/glib,pstglia/platform-external-bluetooth-glib,darren-clark/android_platform_external_bluetooth_glib,endlessm/glib,krichter722/glib,iConsole/Console-OS_external_bluetooth_glib,tchakabam/glib,MathieuDuponchelle/glib,Distrotech/glib,cosimoc/glib,01org/android-bluez-glib,ieei/glib,darren-clark/android_platform_external_bluetooth_glib,johne53/MB3Glib,tchakabam/glib,Distrotech/glib,bluez-android/glib,johne53/MB3Glib,lukasz-skalski/glib,MathieuDuponchelle/glib,MathieuDuponchelle/glib,justinkb/aosp-bluez.glib,tamaskenez/glib,tamaskenez/glib,lukasz-skalski/glib,justinkb/aosp-bluez.glib,pstglia/platform-external-bluetooth-glib,MathieuDuponchelle/glib,iConsole/Console-OS_external_bluetooth_glib,01org/android-bluez-glib,justinkb/aosp-bluez.glib,endlessm/glib,cosimoc/glib,pstglia/platform-external-bluetooth-glib,cention-sany/glib,01org/android-bluez-glib,tamaskenez/glib,cention-sany/glib,01org/android-bluez-glib,cention-sany/glib,Distrotech/glib,pstglia/external-bluetooth-glib,pstglia/external-bluetooth-glib,djdeath/glib,bluez-android/glib,iConsole/Console-OS_external_bluetooth_glib,johne53/MB3Glib,iConsole/Console-OS_external_bluetooth_glib,gale320/glib,darren-clark/android_platform_external_bluetooth_glib,MathieuDuponchelle/glib,mzabaluev/glib,ieei/glib,cention-sany/glib,pstglia/external-bluetooth-glib,cosimoc/glib,krichter722/glib,gale320/glib,justinkb/aosp-bluez.glib,tamaskenez/glib