diff options
author | John (J5) Palmieri <johnp@redhat.com> | 2006-08-16 22:30:15 +0000 |
---|---|---|
committer | John (J5) Palmieri <johnp@redhat.com> | 2006-08-16 22:30:15 +0000 |
commit | 14cc7d28a8308060428bbc9b3dd357eaea3a4749 (patch) | |
tree | 3b2a02f31eb74f3844ad8dcef0fca1d29151a9ed /dbus/dbus-threads-internal.h | |
parent | 5b5da5297552919578266714fa7abf1e45d1131d (diff) |
* dbus/dbus-threads.c: Add static DBusList *uninitialized_mutex_list and
static DBusList *uninitialized_condvar_list to support new late
initialization threading model. In this model threads can be initialized
even after the D-Bus API has been used but still needs to be initialized
before the second thread has been started. Mutexes and condvar addresses
are stored in the two static lists and are replaced with actuall locks
when threads are initalized.
(_dbus_mutex_new_at_location): New method for creating a mutex and placing
the location into the static list
(_dbus_mutex_free_at_location): New method for removing a mutex location
from the static list and freeing the mutex
(_dbus_condvar_new_at_location): New method for creating a conditional
variable and placing the location into the static list
(_dbus_condvar_free_at_location): New method for removing a conditional
variable location from the static list and freeing the conditional variable
(init_uninitialized_locks): Atomic method which goes through the static
lists of mutex and condvar location and updates them with actuall locks
(init_global_locks): changed to init_locks
* dbus/dbus-connection.c:
(_dbus_connection_test_get_locks): New method for tests to check connections
(_dbus_connection_new_for_transport): Use the new at_location mutex and
condvar API
(dbus_connection_allocate_data_slot): Pass in the global lock address
to _dbus_data_slot_allocator_alloc
* dbus/dbus-dataslot.c:
(_dbus_data_slot_allocator_alloc): Use the address of the mutex
instead of the mutex itself
* dbus/dbus-message.c:
(dbus_message_allocate_data_slot): Pass in the global lock address
to _dbus_data_slot_allocator_alloc
* dbus/dbus-pending-call.c:
(dbus_pending_call_allocate_data_slot): Pass in the global lock address
to _dbus_data_slot_allocator_alloc
* dbus/dbus-server.c:
(_dbus_server_init_base): Use the new at_location mutex API
(dbus_server_allocate_data_slot): Pass in the global lock address
to _dbus_data_slot_allocator_alloc
* test/name-test/test-threads-init.c: New test case for late thread
initialization
Diffstat (limited to 'dbus/dbus-threads-internal.h')
-rw-r--r-- | dbus/dbus-threads-internal.h | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/dbus/dbus-threads-internal.h b/dbus/dbus-threads-internal.h index 8cc3a7ac..700c4f75 100644 --- a/dbus/dbus-threads-internal.h +++ b/dbus/dbus-threads-internal.h @@ -29,21 +29,24 @@ DBUS_BEGIN_DECLS -DBusMutex* _dbus_mutex_new (void); -void _dbus_mutex_free (DBusMutex *mutex); -dbus_bool_t _dbus_mutex_lock (DBusMutex *mutex); -dbus_bool_t _dbus_mutex_unlock (DBusMutex *mutex); - -DBusCondVar* _dbus_condvar_new (void); -void _dbus_condvar_free (DBusCondVar *cond); -void _dbus_condvar_wait (DBusCondVar *cond, - DBusMutex *mutex); -dbus_bool_t _dbus_condvar_wait_timeout (DBusCondVar *cond, - DBusMutex *mutex, - int timeout_milliseconds); -void _dbus_condvar_wake_one (DBusCondVar *cond); -void _dbus_condvar_wake_all (DBusCondVar *cond); +DBusMutex* _dbus_mutex_new (void); +void _dbus_mutex_free (DBusMutex *mutex); +dbus_bool_t _dbus_mutex_lock (DBusMutex *mutex); +dbus_bool_t _dbus_mutex_unlock (DBusMutex *mutex); +void _dbus_mutex_new_at_location (DBusMutex **location_p); +void _dbus_mutex_free_at_location (DBusMutex **location_p); +DBusCondVar* _dbus_condvar_new (void); +void _dbus_condvar_free (DBusCondVar *cond); +void _dbus_condvar_wait (DBusCondVar *cond, + DBusMutex *mutex); +dbus_bool_t _dbus_condvar_wait_timeout (DBusCondVar *cond, + DBusMutex *mutex, + int timeout_milliseconds); +void _dbus_condvar_wake_one (DBusCondVar *cond); +void _dbus_condvar_wake_all (DBusCondVar *cond); +void _dbus_condvar_new_at_location (DBusCondVar **location_p); +void _dbus_condvar_free_at_location (DBusCondVar **location_p); DBUS_END_DECLS |