diff options
Diffstat (limited to 'dbus/dbus-sysdeps-thread-win.c')
-rw-r--r-- | dbus/dbus-sysdeps-thread-win.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/dbus/dbus-sysdeps-thread-win.c b/dbus/dbus-sysdeps-thread-win.c index e30e7b87..0887a549 100644 --- a/dbus/dbus-sysdeps-thread-win.c +++ b/dbus/dbus-sysdeps-thread-win.c @@ -30,6 +30,21 @@ #include <windows.h> +static dbus_bool_t global_init_done = FALSE; +static CRITICAL_SECTION init_lock; + +/* Called from C++ code in dbus-init-win.cpp. */ +void +_dbus_threads_windows_init_global (void) +{ + /* this ensures that the object that acts as our global constructor + * actually gets linked in when we're linked statically */ + _dbus_threads_windows_ensure_ctor_linked (); + + InitializeCriticalSection (&init_lock); + global_init_done = TRUE; +} + struct DBusCondVar { DBusList *list; /**< list thread-local-stored events waiting on the cond variable */ CRITICAL_SECTION lock; /**< lock protecting the list */ @@ -269,6 +284,19 @@ _dbus_threads_init_platform_specific (void) return FALSE; } - return dbus_threads_init (NULL); + return TRUE; +} + +void +_dbus_threads_lock_platform_specific (void) +{ + _dbus_assert (global_init_done); + EnterCriticalSection (&init_lock); } +void +_dbus_threads_unlock_platform_specific (void) +{ + _dbus_assert (global_init_done); + LeaveCriticalSection (&init_lock); +} |