1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * gthread.c: thread related functions
5 * Copyright 1998 Sebastian Wilhelmi; University of Karlsruhe
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
24 * Modified by the GLib Team and others 1997-2000. See the AUTHORS
25 * file for a list of people on the GLib Team. See the ChangeLog
26 * files for a list of changes. These files are distributed with
27 * GLib at ftp://ftp.gtk.org/pub/gtk/.
37 #include "gthreadprivate.h"
39 static gint g_thread_priority_map [G_THREAD_PRIORITY_URGENT + 1];
41 #include G_THREAD_SOURCE
43 #ifndef PRIORITY_LOW_VALUE
44 # define PRIORITY_LOW_VALUE 0
47 #ifndef PRIORITY_URGENT_VALUE
48 # define PRIORITY_URGENT_VALUE 0
51 #ifndef PRIORITY_NORMAL_VALUE
52 # define PRIORITY_NORMAL_VALUE \
53 ((PRIORITY_LOW_VALUE * 6 + PRIORITY_URGENT_VALUE * 4) / 10)
54 #endif /* PRIORITY_NORMAL_VALUE */
56 #ifndef PRIORITY_HIGH_VALUE
57 # define PRIORITY_HIGH_VALUE \
58 ((PRIORITY_NORMAL_VALUE + PRIORITY_URGENT_VALUE * 2) / 3)
59 #endif /* PRIORITY_HIGH_VALUE */
62 g_thread_init (GThreadFunctions *init)
64 static gboolean already_done;
67 g_warning ("GThread system no longer supports custom thread implementations.");
74 #ifdef HAVE_G_THREAD_IMPL_INIT
76 #endif /* HAVE_G_THREAD_IMPL_INIT */
78 g_thread_functions_for_glib_use = g_thread_functions_for_glib_use_default;
80 g_thread_priority_map [G_THREAD_PRIORITY_LOW] = PRIORITY_LOW_VALUE;
81 g_thread_priority_map [G_THREAD_PRIORITY_NORMAL] = PRIORITY_NORMAL_VALUE;
82 g_thread_priority_map [G_THREAD_PRIORITY_HIGH] = PRIORITY_HIGH_VALUE;
83 g_thread_priority_map [G_THREAD_PRIORITY_URGENT] = PRIORITY_URGENT_VALUE;
85 g_thread_init_glib ();
89 g_thread_init_with_errorcheck_mutexes (GThreadFunctions *vtable)
91 g_assert (vtable == NULL);