gslice: stop using ctors
authorRyan Lortie <desrt@desrt.ca>
Tue, 4 Oct 2011 20:38:28 +0000 (16:38 -0400)
committerRyan Lortie <desrt@desrt.ca>
Tue, 4 Oct 2011 21:32:41 +0000 (17:32 -0400)
commit5bfb64d50704f334ae6692184e53de6dbb2e6be4
treef7f5649acd133b2a8924bcfd9d4e5c2cccb512ab
parentf1512917e6e46e30000bcca2ebf06ef9d15b751d
gslice: stop using ctors

We can't initialise gslice from a ctor because g_slice_set_config() must
be called before gslice initialisation.

Instead, do the initialisation in a threadsafe way from the
initialisation function for the thread private data.  This will only be
called once per thread so the synchronisation doesn't pose a significant
overhead here.

Ensure that we try to grab the thread private data directly on entrance
to g_slice_alloc() so that we force the initialisation to occur.
Grabbing the private data is the common case anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=660887
glib/gslice.c