Commit Graph

108 Commits

Author SHA1 Message Date
Matthias Clasen
0044763a71 Clean up g_thread_yield implementation
This was the last macro wrapper that was directly accessing the
vtable. Make it a regular function, like the rest.
2011-09-21 16:06:54 -04:00
Ryan Lortie
90679997ec Continue GPrivate rework
We remove the macros while at the same time switching all libglib users
from g_private_new() to g_private_init().  We deal with the strange
expectations of the libglib code that g_private_* should work before the
GPrivate has been initialised with a temporary shim.
2011-09-21 16:06:53 -04:00
Ryan Lortie
b0d83576e2 Rework GPrivate
- expose the structure types for GLib internal use only

 - avoid infinite recursion hazards by ensuring that GPrivate never
   calls back into any other part of GLib

 - substantially rework the Windows implementation so that it never
   holds locks, contains no arbitrary limits and doesn't waste
   100*sizeof(void*) per thread

We have to keep the macro hacks for the time being since some code
inside libglib depends on it.
2011-09-21 16:06:53 -04:00
Ryan Lortie
646de11ae7 Remove "temporary until GLib is fixed" code
The original GMutex/GCond rework patch introduced some temporary code to
cope with GLib's old approach to thread initialisation.  These are no
longer required.
2011-09-21 16:06:53 -04:00
Ryan Lortie
e996a836e8 Port g_cond_new to use GSlice
Now that nothing inside of GLib is using g_cond_new(), we can implement
it using GSlice.  Since the implementations for POSIX and Windows are
now the same, move it to gthread.c.
2011-09-21 16:06:53 -04:00
Ryan Lortie
22b3e26034 Port g_mutex_new to use GSlice
Now that nothing inside of GLib is using g_mutex_new, we can implement
it using GSlice.  Since the implementations for POSIX and Windows are
now the same, move it to gthread.c.
2011-09-21 16:06:49 -04:00
Ryan Lortie
80730bc75c Rework GMutex and GCond APIs
Do a substantial rework of the GMutex and GCond APIs.

 - remove all of the macro indirection hackery which is no longer needed
   since we dropped support for switchable thread implementations

 - expose the structure types and add G_MUTEX_INIT and G_COND_INIT
   static initialiser macros

 - add g_mutex_init() and g_mutex_clear() for use when embedding GMutex
   into another structure type and do the same for GCond as well

 - avoid infinite recursion hazards by ensuring that neither GCond or
   GMutex ever calls back into any other part of GLib

 - substantially rework the Windows implementation of GCond and GMutex
   to use the SRWLock and CONDITION_VARIABLE APIs present on Windows
   2008/Vista and later, emulating these APIs on XP
2011-09-21 15:55:36 -04:00
Ryan Lortie
cfa1d0540e Move the GThread implementations to glib/
We can now get threads initialised from inside of libglib by calling
g_thread_init_glib().
2011-09-09 12:47:40 -04:00