summaryrefslogtreecommitdiff
path: root/dbus/dbus-internals.h
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-04-15 13:51:19 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-05-09 10:32:54 +0100
commitc36f21a2e91730e9ae52e8945305aa3072f0e508 (patch)
treee2aead3eb7ae2df9042aac40411bfddb9a1231f6 /dbus/dbus-internals.h
parent7ac9b68220a2f48bc2942aaa909d6ba1f4605f73 (diff)
downloaddbus-c36f21a2e91730e9ae52e8945305aa3072f0e508.tar.gz
DBusAtomic: on Unix, use pthreads mutexes for fallback
On pthreads platforms, POSIX guarantees that we can "allocate" mutexes as library-global variables, without involving malloc. This means we don't need to error-check their allocation - if the dynamic linker succeeds, then we have enough memory for all our globals - which is an important step towards being thread-safe by default. In particular, making atomic operations never rely on DBusMutex means that we are free to implement parts of DBusMutex in terms of DBusAtomic, if it would help. We do not currently support any non-Windows platform that does not have pthreads. This is unlikely to change. On Windows, we already used real atomic operations; we can just delete the unused global variable. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54972 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Alban Crequy <alban.crequy@collabora.co.uk> Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de>
Diffstat (limited to 'dbus/dbus-internals.h')
-rw-r--r--dbus/dbus-internals.h5
1 files changed, 0 insertions, 5 deletions
diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h
index 80376ad5..28486a81 100644
--- a/dbus/dbus-internals.h
+++ b/dbus/dbus-internals.h
@@ -323,12 +323,7 @@ _DBUS_DECLARE_GLOBAL_LOCK (win_fds);
_DBUS_DECLARE_GLOBAL_LOCK (sid_atom_cache);
_DBUS_DECLARE_GLOBAL_LOCK (machine_uuid);
-#if !DBUS_USE_SYNC
-_DBUS_DECLARE_GLOBAL_LOCK (atomic);
-#define _DBUS_N_GLOBAL_LOCKS (15)
-#else
#define _DBUS_N_GLOBAL_LOCKS (14)
-#endif
dbus_bool_t _dbus_threads_init_debug (void);