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

John (J5) Palmieri johnp at redhat.com
Wed Aug 16 13:24:19 PDT 2006


New patch.

On Wed, 2006-08-16 at 14:37 -0400, Havoc Pennington wrote:
> 
> John (J5) Palmieri wrote:
> > *location_p == NULL indicates OOM (as it does with _dbus_mutex_new).  I
> > can change this to returning a bool but isn't that superfluous or is the
> > goal here to make it clearer to a developer? 
> > 
> 
> Ah OK, that sounds fine, obvious in retrospect.
> 
> >> The test thread_init_generation == 0 should be
> >> thread_init_generation != _dbus_current_generation instead, so multiple 
> >> generations can be used.
> > 
> > Easy change but I don't understand what a generation is and how threads
> > can be initialized more than once.  Just for my knowledge can you give a
> > brief explanation.
> > 
> 
> dbus can be shut down (completely uninitialized) with dbus_shutdown(), 
> at that point the generation is incremented and any of the init/setup 
> stuff can be used again.
> 
> Times when you might shut down:
>   - to help in memory leak tracking (e.g. the test suite relies on it)
>   - if you are using the library from a plugin and know the main app
>     isn't using it
> 
> The generation counter is used rather than a simple "bool initialized" 
> because it lets us detect more kinds of mistake, such as using a 
> connection after shutting down the generation that created it.
> 
> Havoc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbus-init-threads-late-4.patch
Type: text/x-patch
Size: 33503 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/dbus/attachments/20060816/916f4c12/dbus-init-threads-late-4-0001.bin


More information about the dbus mailing list