mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-07-23 02:17:51 +02:00
Removed POSIX_*. Defined G_THREAD_SOURCE to "gthread-win32.c".
2001-05-22 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * config.h.win32.in: Removed POSIX_*. Defined G_THREAD_SOURCE to "gthread-win32.c". * glibconfig.h.win32.in: Define G_HAVE_ISO_VARARGS for gcc, don't know about MSC. Define G_THREADS_IMPL_WIN32 instead of G_THREADS_IMPL_POSIX and define the right static mutex macros and types. * build/win32/make.mingw (CXX): Removed PTHREAD defs. Added -O2 -Wall to compile flags. * gthread/gthread-impl.c (g_thread_init): Move the thread implementation initialization to before assigning GThreadFuncs, which now is just struct assigned and not memcpy'ed. Completed check for zero members of GThreadFuncs. * gthread/makefile.mingw: Don't link to pthread anymore. * gthread/gthread-win32.c: New file for native thread support for win32. Thanks to Hans Breuer <hans@breuer.org> to got me kickstarted. * gthread/Makefile.am: Also distribute gthread-win32.c.
This commit is contained in:
committed by
Sebastian Wilhelmi
parent
673e99b7f3
commit
d6ed8e36e7
@@ -314,19 +314,23 @@ g_thread_init (GThreadFunctions* init)
|
||||
thread_system_already_initialized = TRUE;
|
||||
|
||||
if (init == NULL)
|
||||
init = &g_thread_functions_for_glib_use_default;
|
||||
{
|
||||
#ifdef HAVE_G_THREAD_IMPL_INIT
|
||||
/* now do any initialization stuff required by the
|
||||
* implementation, but only if called with a NULL argument, of
|
||||
* course. Otherwise it's up to the user to do so. */
|
||||
g_thread_impl_init();
|
||||
#endif /* HAVE_G_THREAD_IMPL_INIT */
|
||||
init = &g_thread_functions_for_glib_use_default;
|
||||
}
|
||||
else
|
||||
g_thread_use_default_impl = FALSE;
|
||||
|
||||
#if defined (G_PLATFORM_WIN32) && defined (__GNUC__)
|
||||
memcpy(&g_thread_functions_for_glib_use, init, sizeof (*init));
|
||||
#else
|
||||
g_thread_functions_for_glib_use = *init;
|
||||
#endif
|
||||
|
||||
/* It is important, that g_threads_got_initialized is not set before the
|
||||
* thread initialization functions of the different modules are called
|
||||
*/
|
||||
|
||||
supported = (init->mutex_new &&
|
||||
init->mutex_lock &&
|
||||
init->mutex_trylock &&
|
||||
@@ -340,7 +344,13 @@ g_thread_init (GThreadFunctions* init)
|
||||
init->cond_free &&
|
||||
init->private_new &&
|
||||
init->private_get &&
|
||||
init->private_get);
|
||||
init->private_get &&
|
||||
init->thread_create &&
|
||||
init->thread_yield &&
|
||||
init->thread_join &&
|
||||
init->thread_exit &&
|
||||
init->thread_set_priority &&
|
||||
init->thread_self);
|
||||
|
||||
/* if somebody is calling g_thread_init (), it means that he wants to
|
||||
* have thread support, so check this
|
||||
@@ -353,15 +363,6 @@ g_thread_init (GThreadFunctions* init)
|
||||
g_error ("The supplied thread function vector is invalid.");
|
||||
}
|
||||
|
||||
/* now do any initialization stuff required by the implementation,
|
||||
* but only if called with a NULL argument, of course. Otherwise
|
||||
* it's up to the user to do so. */
|
||||
|
||||
#ifdef HAVE_G_THREAD_IMPL_INIT
|
||||
if (g_thread_use_default_impl)
|
||||
g_thread_impl_init();
|
||||
#endif
|
||||
|
||||
g_thread_priority_map [G_THREAD_PRIORITY_LOW] = PRIORITY_LOW_VALUE;
|
||||
g_thread_priority_map [G_THREAD_PRIORITY_NORMAL] = PRIORITY_NORMAL_VALUE;
|
||||
g_thread_priority_map [G_THREAD_PRIORITY_HIGH] = PRIORITY_HIGH_VALUE;
|
||||
|
Reference in New Issue
Block a user