1998-12-15 06:28:02 +01:00
|
|
|
/* GLIB - Library of useful routines for C programming
|
|
|
|
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
|
|
*
|
|
|
|
* gthread.c: thread related functions
|
|
|
|
* Copyright 1998 Sebastian Wilhelmi; University of Karlsruhe
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
2000-07-26 13:02:02 +02:00
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
1998-12-15 06:28:02 +01:00
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
2000-07-26 13:02:02 +02:00
|
|
|
* Lesser General Public License for more details.
|
1998-12-15 06:28:02 +01:00
|
|
|
*
|
2000-07-26 13:02:02 +02:00
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
1998-12-15 06:28:02 +01:00
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
1999-02-24 07:14:27 +01:00
|
|
|
/*
|
2000-07-26 13:02:02 +02:00
|
|
|
* Modified by the GLib Team and others 1997-2000. See the AUTHORS
|
1999-02-24 07:14:27 +01:00
|
|
|
* file for a list of people on the GLib Team. See the ChangeLog
|
|
|
|
* files for a list of changes. These files are distributed with
|
|
|
|
* GLib at ftp://ftp.gtk.org/pub/gtk/.
|
|
|
|
*/
|
|
|
|
|
1998-12-15 06:28:02 +01:00
|
|
|
/*
|
|
|
|
* MT safe
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
static gboolean thread_system_already_initialized = FALSE;
|
2000-11-21 16:27:44 +01:00
|
|
|
static gint g_thread_priority_map [G_THREAD_PRIORITY_URGENT];
|
1998-12-15 06:28:02 +01:00
|
|
|
|
|
|
|
#include G_THREAD_SOURCE
|
|
|
|
|
2000-11-21 16:27:44 +01:00
|
|
|
#ifndef PRIORITY_LOW_VALUE
|
|
|
|
# define PRIORITY_LOW_VALUE 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PRIORITY_URGENT_VALUE
|
|
|
|
# define PRIORITY_URGENT_VALUE 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef PRIORITY_NORMAL_VALUE
|
|
|
|
# define PRIORITY_NORMAL_VALUE \
|
|
|
|
PRIORITY_LOW_VALUE + (PRIORITY_URGENT_VALUE - PRIORITY_LOW_VALUE) * 40 / 100
|
|
|
|
#endif /* PRIORITY_NORMAL_VALUE */
|
|
|
|
|
|
|
|
#ifndef PRIORITY_HIGH_VALUE
|
|
|
|
# define PRIORITY_HIGH_VALUE \
|
|
|
|
PRIORITY_LOW_VALUE + (PRIORITY_URGENT_VALUE - PRIORITY_LOW_VALUE) * 80 / 100
|
|
|
|
#endif /* PRIORITY_HIGH_VALUE */
|
|
|
|
|
1998-12-15 06:28:02 +01:00
|
|
|
void g_mutex_init (void);
|
|
|
|
void g_mem_init (void);
|
|
|
|
void g_messages_init (void);
|
|
|
|
|
2000-09-29 15:10:41 +02:00
|
|
|
#define G_MUTEX_DEBUG_INFO(mutex) (*((gpointer*)(((char*)mutex)+G_MUTEX_SIZE)))
|
|
|
|
|
|
|
|
typedef struct _ErrorCheckInfo ErrorCheckInfo;
|
|
|
|
struct _ErrorCheckInfo
|
|
|
|
{
|
|
|
|
gchar *location;
|
|
|
|
GThread *owner;
|
|
|
|
};
|
|
|
|
|
|
|
|
static GMutex *
|
|
|
|
g_mutex_new_errorcheck_impl (void)
|
|
|
|
{
|
|
|
|
GMutex *retval = g_thread_functions_for_glib_use_default.mutex_new ();
|
|
|
|
retval = g_realloc (retval, G_MUTEX_SIZE + sizeof (gpointer));
|
|
|
|
G_MUTEX_DEBUG_INFO (retval) = NULL;
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
g_mutex_lock_errorcheck_impl (GMutex *mutex,
|
2000-11-28 13:56:57 +01:00
|
|
|
gulong magic,
|
2000-09-29 15:10:41 +02:00
|
|
|
gchar *location)
|
|
|
|
{
|
|
|
|
ErrorCheckInfo *info;
|
|
|
|
GThread *self = g_thread_self ();
|
2000-11-28 13:56:57 +01:00
|
|
|
|
|
|
|
if (magic != G_MUTEX_DEBUG_MAGIC)
|
|
|
|
location = "unknown";
|
|
|
|
|
2000-09-29 15:10:41 +02:00
|
|
|
if (G_MUTEX_DEBUG_INFO (mutex) == NULL)
|
|
|
|
{
|
|
|
|
/* if the debug info is NULL, we have not yet locked that mutex,
|
|
|
|
* so we do it now */
|
|
|
|
g_thread_functions_for_glib_use_default.mutex_lock (mutex);
|
2000-11-28 13:56:57 +01:00
|
|
|
/* Now we have to check again, because another thread might have
|
|
|
|
* tried to lock the mutex at the same time we did. This
|
|
|
|
* technique is not 100% save on systems without decent cache
|
|
|
|
* coherence, but we have no choice */
|
2000-09-29 15:10:41 +02:00
|
|
|
if (G_MUTEX_DEBUG_INFO (mutex) == NULL)
|
|
|
|
{
|
|
|
|
info = G_MUTEX_DEBUG_INFO (mutex) = g_new0 (ErrorCheckInfo, 1);
|
|
|
|
}
|
|
|
|
g_thread_functions_for_glib_use_default.mutex_unlock (mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
info = G_MUTEX_DEBUG_INFO (mutex);
|
|
|
|
if (info->owner == self)
|
2000-11-28 13:56:57 +01:00
|
|
|
g_error ("Trying to recursivly lock a mutex at '%s', "
|
|
|
|
"previously locked at '%s'",
|
|
|
|
location, info->location);
|
2000-09-29 15:10:41 +02:00
|
|
|
|
|
|
|
g_thread_functions_for_glib_use_default.mutex_lock (mutex);
|
|
|
|
|
2000-11-28 13:56:57 +01:00
|
|
|
info->owner = self;
|
|
|
|
info->location = location;
|
2000-09-29 15:10:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
g_mutex_trylock_errorcheck_impl (GMutex *mutex,
|
|
|
|
gulong magic,
|
|
|
|
gchar *location)
|
|
|
|
{
|
|
|
|
ErrorCheckInfo *info = G_MUTEX_DEBUG_INFO (mutex);
|
|
|
|
GThread *self = g_thread_self ();
|
2000-11-28 13:56:57 +01:00
|
|
|
|
|
|
|
if (magic != G_MUTEX_DEBUG_MAGIC)
|
|
|
|
location = "unknown";
|
|
|
|
|
2000-09-29 15:10:41 +02:00
|
|
|
if (!info)
|
|
|
|
{
|
|
|
|
/* This mutex has not yet been used, so simply lock and return TRUE */
|
2000-11-28 13:56:57 +01:00
|
|
|
g_mutex_lock_errorcheck_impl (mutex, magic, location);
|
2000-09-29 15:10:41 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
2000-11-28 13:56:57 +01:00
|
|
|
|
2000-09-29 15:10:41 +02:00
|
|
|
if (info->owner == self)
|
2000-11-28 13:56:57 +01:00
|
|
|
g_error ("Trying to recursivly lock a mutex at '%s', "
|
|
|
|
"previously locked at '%s'",
|
|
|
|
location, info->location);
|
2000-09-29 15:10:41 +02:00
|
|
|
|
|
|
|
if (!g_thread_functions_for_glib_use_default.mutex_trylock (mutex))
|
|
|
|
return FALSE;
|
|
|
|
|
2000-11-28 13:56:57 +01:00
|
|
|
info->owner = self;
|
|
|
|
info->location = location;
|
|
|
|
|
2000-09-29 15:10:41 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
g_mutex_unlock_errorcheck_impl (GMutex *mutex,
|
|
|
|
gulong magic,
|
|
|
|
gchar *location)
|
|
|
|
{
|
|
|
|
ErrorCheckInfo *info = G_MUTEX_DEBUG_INFO (mutex);
|
|
|
|
GThread *self = g_thread_self ();
|
2000-11-28 13:56:57 +01:00
|
|
|
|
2000-09-29 15:10:41 +02:00
|
|
|
if (magic != G_MUTEX_DEBUG_MAGIC)
|
2000-11-28 13:56:57 +01:00
|
|
|
location = "unknown";
|
|
|
|
|
|
|
|
if (!info || info->owner == NULL)
|
|
|
|
g_error ("Trying to unlock an unlocked mutex at '%s'", location);
|
|
|
|
|
|
|
|
if (info->owner != self)
|
|
|
|
g_warning ("Trying to unlock a mutex at '%s', "
|
|
|
|
"previously locked by a different thread at '%s'",
|
|
|
|
location, info->location);
|
|
|
|
|
2000-09-29 15:10:41 +02:00
|
|
|
info->owner = NULL;
|
2000-11-28 13:56:57 +01:00
|
|
|
info->location = NULL;
|
|
|
|
|
2000-09-29 15:10:41 +02:00
|
|
|
g_thread_functions_for_glib_use_default.mutex_unlock (mutex);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
g_mutex_free_errorcheck_impl (GMutex *mutex)
|
|
|
|
{
|
2001-01-29 17:32:26 +01:00
|
|
|
if (info && info->owner != NULL)
|
|
|
|
g_error ("Trying to free a locked mutex at '%s', "
|
|
|
|
"which was previously locked at '%s'",
|
|
|
|
location, info->location);
|
|
|
|
|
2000-09-29 15:10:41 +02:00
|
|
|
g_free (G_MUTEX_DEBUG_INFO (mutex));
|
|
|
|
g_thread_functions_for_glib_use_default.mutex_free (mutex);
|
|
|
|
}
|
|
|
|
|
2000-11-28 13:56:57 +01:00
|
|
|
static void
|
|
|
|
g_cond_wait_errorcheck_impl (GCond *cond,
|
|
|
|
GMutex *mutex,
|
|
|
|
gulong magic,
|
|
|
|
gchar *location)
|
|
|
|
{
|
|
|
|
|
|
|
|
ErrorCheckInfo *info = G_MUTEX_DEBUG_INFO (mutex);
|
|
|
|
GThread *self = g_thread_self ();
|
|
|
|
|
|
|
|
if (magic != G_MUTEX_DEBUG_MAGIC)
|
|
|
|
location = "unknown";
|
|
|
|
|
|
|
|
if (!info || info->owner == NULL)
|
|
|
|
g_error ("Trying to use an unlocked mutex in g_cond_wait() at '%s'",
|
|
|
|
location);
|
|
|
|
|
|
|
|
if (info->owner != self)
|
|
|
|
g_error ("Trying to use a mutex locked by another thread in "
|
|
|
|
"g_cond_wait() at '%s'", location);
|
|
|
|
|
|
|
|
info->owner = NULL;
|
|
|
|
location = info->location;
|
|
|
|
|
|
|
|
g_thread_functions_for_glib_use_default.cond_wait (cond, mutex);
|
|
|
|
|
|
|
|
info->owner = self;
|
|
|
|
info->location = location;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
g_cond_timed_wait_errorcheck_impl (GCond *cond,
|
|
|
|
GMutex *mutex,
|
|
|
|
GTimeVal *end_time,
|
|
|
|
gulong magic,
|
|
|
|
gchar *location)
|
|
|
|
{
|
|
|
|
ErrorCheckInfo *info = G_MUTEX_DEBUG_INFO (mutex);
|
|
|
|
GThread *self = g_thread_self ();
|
|
|
|
gboolean retval;
|
|
|
|
|
|
|
|
if (magic != G_MUTEX_DEBUG_MAGIC)
|
|
|
|
location = "unknown";
|
|
|
|
|
|
|
|
if (!info || info->owner == NULL)
|
|
|
|
g_error ("Trying to use an unlocked mutex in g_cond_timed_wait() at '%s'",
|
|
|
|
location);
|
|
|
|
|
|
|
|
if (info->owner != self)
|
|
|
|
g_error ("Trying to use a mutex locked by another thread in "
|
|
|
|
"g_cond_timed_wait() at '%s'", location);
|
|
|
|
|
|
|
|
info->owner = NULL;
|
|
|
|
location = info->location;
|
|
|
|
|
|
|
|
retval = g_thread_functions_for_glib_use_default.cond_timed_wait (cond,
|
|
|
|
mutex,
|
|
|
|
end_time);
|
|
|
|
|
|
|
|
info->owner = self;
|
|
|
|
info->location = location;
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-09-29 15:10:41 +02:00
|
|
|
/* unshadow function declaration. See glib.h */
|
|
|
|
#undef g_thread_init
|
|
|
|
|
|
|
|
void
|
|
|
|
g_thread_init_with_errorcheck_mutexes (GThreadFunctions* init)
|
|
|
|
{
|
|
|
|
GThreadFunctions errorcheck_functions;
|
|
|
|
if (init)
|
|
|
|
g_error ("Errorcheck mutexes can only be used for native "
|
|
|
|
"thread implementations. Sorry." );
|
|
|
|
errorcheck_functions = g_thread_functions_for_glib_use_default;
|
|
|
|
errorcheck_functions.mutex_new = g_mutex_new_errorcheck_impl;
|
|
|
|
errorcheck_functions.mutex_lock =
|
|
|
|
(void (*)(GMutex *)) g_mutex_lock_errorcheck_impl;
|
|
|
|
errorcheck_functions.mutex_trylock =
|
|
|
|
(gboolean (*)(GMutex *)) g_mutex_trylock_errorcheck_impl;
|
|
|
|
errorcheck_functions.mutex_unlock =
|
|
|
|
(void (*)(GMutex *)) g_mutex_unlock_errorcheck_impl;
|
|
|
|
errorcheck_functions.mutex_free = g_mutex_free_errorcheck_impl;
|
2000-11-28 13:56:57 +01:00
|
|
|
errorcheck_functions.cond_wait = g_cond_wait_errorcheck_impl;
|
|
|
|
errorcheck_functions.cond_timed_wait = g_cond_timed_wait_errorcheck_impl;
|
2000-09-29 15:10:41 +02:00
|
|
|
|
|
|
|
g_thread_init (&errorcheck_functions);
|
|
|
|
}
|
|
|
|
|
1998-12-15 06:28:02 +01:00
|
|
|
void
|
1998-12-16 06:38:35 +01:00
|
|
|
g_thread_init (GThreadFunctions* init)
|
1998-12-15 06:28:02 +01:00
|
|
|
{
|
|
|
|
gboolean supported;
|
|
|
|
|
1998-12-16 06:38:35 +01:00
|
|
|
#ifndef G_THREADS_ENABLED
|
|
|
|
g_error ("GLib thread support is disabled.");
|
|
|
|
#endif /* !G_THREADS_ENABLED */
|
|
|
|
|
1998-12-15 06:28:02 +01:00
|
|
|
if (thread_system_already_initialized)
|
1998-12-16 06:38:35 +01:00
|
|
|
g_error ("GThread system may only be initialized once.");
|
1998-12-15 06:28:02 +01:00
|
|
|
|
|
|
|
thread_system_already_initialized = TRUE;
|
|
|
|
|
|
|
|
if (init == NULL)
|
|
|
|
init = &g_thread_functions_for_glib_use_default;
|
|
|
|
else
|
|
|
|
g_thread_use_default_impl = FALSE;
|
|
|
|
|
1999-10-04 04:32:50 +02:00
|
|
|
#if defined (G_OS_WIN32) && defined (__GNUC__)
|
1999-04-24 15:52:51 +02:00
|
|
|
memcpy(&g_thread_functions_for_glib_use, init, sizeof (*init));
|
|
|
|
#else
|
1998-12-15 06:28:02 +01:00
|
|
|
g_thread_functions_for_glib_use = *init;
|
1999-04-24 15:52:51 +02:00
|
|
|
#endif
|
1998-12-16 06:38:35 +01:00
|
|
|
/* 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 &&
|
|
|
|
init->mutex_unlock &&
|
|
|
|
init->mutex_free &&
|
|
|
|
init->cond_new &&
|
|
|
|
init->cond_signal &&
|
|
|
|
init->cond_broadcast &&
|
|
|
|
init->cond_wait &&
|
|
|
|
init->cond_timed_wait &&
|
|
|
|
init->cond_free &&
|
|
|
|
init->private_new &&
|
|
|
|
init->private_get &&
|
|
|
|
init->private_get);
|
1998-12-15 06:28:02 +01:00
|
|
|
|
|
|
|
/* if somebody is calling g_thread_init (), it means that he wants to
|
1998-12-16 06:38:35 +01:00
|
|
|
* have thread support, so check this
|
|
|
|
*/
|
1998-12-15 06:28:02 +01:00
|
|
|
if (!supported)
|
|
|
|
{
|
|
|
|
if (g_thread_use_default_impl)
|
|
|
|
g_error ("Threads are not supported on this platform.");
|
|
|
|
else
|
|
|
|
g_error ("The supplied thread function vector is invalid.");
|
|
|
|
}
|
|
|
|
|
Completed the thread support in GLib. Thread creation, prioritizing
1999-06-17 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in, acglib.m4, acconfig.h, glib.h, gthread.c:
Completed the thread support in GLib. Thread creation,
prioritizing threads, yielding, joining threads as well as
reader/writer locks and recursive mutexes are now in place. Please
test heavily on your platform. It is so far tested on
Linux/i386/pthreads, Solaris/Sparc/pthreads and
Solaris/Sparc/solaristhreads.
* gtimer.c, glib.h: Implement g_usleep (gulong microseconds) for
thread safe sleeping. (sleep() is not MT-safe at all!)
* gutils.c: Avoid compiler warning.
* tests/Makefile.am, tests/thread-test.c: New program to test some
aspects of the thread implementation.
* gthread.c, Makefile.am: Renamed from gmutex.c to reflect the
change of content.
* configure.in: Purged all appearances of nspr.
* gthread/gthread-posix.c, gthread-solaris.c: Added the native
implementations for the GLib's extended thread support.
* gthread/gthread-nspr.c: Removed for good. NSPR is nothing we
would want to build upon.
* gthread/gthread.c: Renamed to gthread-impl.c to avoid
confusion with ../gthread.c (Formerly known as the file called
gmutex.c)
* gthread/testgthread.c: Removed. The new and much extended
tests are in ../tests/thread-test.c.
* gthread/Makefile.am: Changed to reflect the changes above.
1999-06-17 17:39:31 +02:00
|
|
|
/* now do any initialization stuff required by the implementation,
|
2000-02-22 14:11:24 +01:00
|
|
|
* but only if called with a NULL argument, of course. Otherwise
|
|
|
|
* it's up to the user to do so. */
|
Completed the thread support in GLib. Thread creation, prioritizing
1999-06-17 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in, acglib.m4, acconfig.h, glib.h, gthread.c:
Completed the thread support in GLib. Thread creation,
prioritizing threads, yielding, joining threads as well as
reader/writer locks and recursive mutexes are now in place. Please
test heavily on your platform. It is so far tested on
Linux/i386/pthreads, Solaris/Sparc/pthreads and
Solaris/Sparc/solaristhreads.
* gtimer.c, glib.h: Implement g_usleep (gulong microseconds) for
thread safe sleeping. (sleep() is not MT-safe at all!)
* gutils.c: Avoid compiler warning.
* tests/Makefile.am, tests/thread-test.c: New program to test some
aspects of the thread implementation.
* gthread.c, Makefile.am: Renamed from gmutex.c to reflect the
change of content.
* configure.in: Purged all appearances of nspr.
* gthread/gthread-posix.c, gthread-solaris.c: Added the native
implementations for the GLib's extended thread support.
* gthread/gthread-nspr.c: Removed for good. NSPR is nothing we
would want to build upon.
* gthread/gthread.c: Renamed to gthread-impl.c to avoid
confusion with ../gthread.c (Formerly known as the file called
gmutex.c)
* gthread/testgthread.c: Removed. The new and much extended
tests are in ../tests/thread-test.c.
* gthread/Makefile.am: Changed to reflect the changes above.
1999-06-17 17:39:31 +02:00
|
|
|
|
|
|
|
#ifdef HAVE_G_THREAD_IMPL_INIT
|
|
|
|
if (g_thread_use_default_impl)
|
|
|
|
g_thread_impl_init();
|
|
|
|
#endif
|
|
|
|
|
2000-11-21 16:27:44 +01:00
|
|
|
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;
|
|
|
|
g_thread_priority_map [G_THREAD_PRIORITY_URGENT] = PRIORITY_URGENT_VALUE;
|
|
|
|
|
1998-12-15 06:28:02 +01:00
|
|
|
/* now call the thread initialization functions of the different
|
1998-12-16 06:38:35 +01:00
|
|
|
* glib modules. order does matter, g_mutex_init MUST come first.
|
|
|
|
*/
|
1998-12-15 06:28:02 +01:00
|
|
|
g_mutex_init ();
|
|
|
|
g_mem_init ();
|
|
|
|
g_messages_init ();
|
|
|
|
|
1998-12-16 06:38:35 +01:00
|
|
|
/* now we can set g_threads_got_initialized and thus enable
|
|
|
|
* all the thread functions
|
|
|
|
*/
|
|
|
|
g_threads_got_initialized = TRUE;
|
Completed the thread support in GLib. Thread creation, prioritizing
1999-06-17 Sebastian Wilhelmi <wilhelmi@ira.uka.de>
* configure.in, acglib.m4, acconfig.h, glib.h, gthread.c:
Completed the thread support in GLib. Thread creation,
prioritizing threads, yielding, joining threads as well as
reader/writer locks and recursive mutexes are now in place. Please
test heavily on your platform. It is so far tested on
Linux/i386/pthreads, Solaris/Sparc/pthreads and
Solaris/Sparc/solaristhreads.
* gtimer.c, glib.h: Implement g_usleep (gulong microseconds) for
thread safe sleeping. (sleep() is not MT-safe at all!)
* gutils.c: Avoid compiler warning.
* tests/Makefile.am, tests/thread-test.c: New program to test some
aspects of the thread implementation.
* gthread.c, Makefile.am: Renamed from gmutex.c to reflect the
change of content.
* configure.in: Purged all appearances of nspr.
* gthread/gthread-posix.c, gthread-solaris.c: Added the native
implementations for the GLib's extended thread support.
* gthread/gthread-nspr.c: Removed for good. NSPR is nothing we
would want to build upon.
* gthread/gthread.c: Renamed to gthread-impl.c to avoid
confusion with ../gthread.c (Formerly known as the file called
gmutex.c)
* gthread/testgthread.c: Removed. The new and much extended
tests are in ../tests/thread-test.c.
* gthread/Makefile.am: Changed to reflect the changes above.
1999-06-17 17:39:31 +02:00
|
|
|
|
|
|
|
/* we want the main thread to run with normal priority */
|
|
|
|
g_thread_set_priority (g_thread_self(), G_THREAD_PRIORITY_NORMAL);
|
|
|
|
}
|