[patch] Add a level of abstraction to condvars and mutexes so we can initalize them late

Havoc Pennington hp at redhat.com
Wed Aug 16 05:29:40 PDT 2006


John (J5) Palmieri wrote:
>>  /**
>> + * This does the same thing as _dbus_mutex_new.  It however
>> + * gives another level of indirection by allocating a pointer
>> + * to point to the mutex location.  This allows the threading
>> + * module to swap out dummy mutexes for real a real mutex so libraries
>> + * can initialize threads even after the D-Bus API has been used.
>> + *
>> + * @returns the location of a new mutex or #NULL on OOM
>> + */
>> +DBusMutex**
>> +_dbus_mutex_new_at_location (void)
>> +{

Oh, I missed this before - what I'd intended was:

dbus_bool_t
_dbus_mutex_new_at_location(DBusMutex **location_p)
{
   *location_p = _dbus_mutex_new();
   ...
}

then the patch would be even smaller...

Havoc



More information about the dbus mailing list