GThread is freed using some very slightly confusing logic: if the thread
was created 'joinable', then the structure is freed after the join()
call succeeds (since we know the thread has exited). If the thread was
not created 'joinable' then the free is when the thread quits (since we
know 'join' will not be called later).
Move to a straight ref-counting system: 1 ref owned by the thread and 1
extra ref if the thread is joinable. Both thread quit and joining will
decrease the refcount by 1.
Make the POSIX backend a little bit more like the win32 one in terms of
how we deal with joinability.
Calling g_system_thread_join() is now optional, and
g_system_thread_wait() can be safely called by multiple threads.
There is no longer any internal concept of joinability.
Merge the GThreadData with the GThreadWin32 struct. Drop the extra TLS
variable.
Close the handle on _free(), which means that there is no leak if
g_system_thread_join() isn't called.
Remove all internal concept of joinability.
Keep track of if we created a thread for ourselves or if the GThread*
was allocated in response to g_thread_self() on a previously-unknown
thread.
Only call g_system_thread_free() in the first case.
Wrap GRealThread in a GThreadPosix that includes its own pthread_t field
called "system_thread" and use that instead of the generic field in
GRealThread.
Add g_system_thread_new() and g_system_thread_free(), implemented with
GSlice. Use those instead of g_new() and g_free().
Presently, the backends are both doing the same thing. This will change
soon.
The use of system_thread is now limited to joining. We don't do that
for threads that we didn't create for ourselves, so we don't need to
call g_system_thread_self() to fill in system_thread for those.
...instead of having a 'next' pointer in the GThread struct.
Now GThread contains no fields used only by deprecated code (except for
the rather generic setup function field).
It is possible for _g_io_module_get_default() to be called recursively
(eg, if a module of one type is loaded that tries to look up gsettings
from its init() method and ends up causing the gsettings module to be
loaded). So use a recursive mutex.
Thanks to the modifications in 3d4846d923,
GStaticPrivate is not so directly tied in with GThread anymore. It is
now a simple matter to cut it out completely by using a GPrivate to
store the GArray instead of storing it in the GThread.
Get rid of _CRT_SECURE_NO_WARNINGS and _CRT_NONSTDC_NO_WARNINGS
from the preprocessor definitions as those two macros are now defined
in msvc_recommended_pragmas.h, which is force-included in these projects
via the property sheets. This will silence C4005 warnings on macro
redefinition.
Don't disable warning C4996 as that is the Visual C++ warning triggered by
__declspec(deprecated) and __declspec(deprecated('..."))-disabling that
warning will defeat the purpose of G_DPRECATED/G_DEPRECATED_FOR.
For people who don't want to see the GLib deprecation warnings during GLib
compilation, define GLIB_DISABLE_DEPRECATION_WARNINGS in the projects or
property sheet.