]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/gthr.h
* Makefile.in (GTHREAD_FLAGS): New var.
[thirdparty/gcc.git] / gcc / gthr.h
CommitLineData
58febf9e 1/* Threads compatibily routines for libgcc2. */
2/* Compile this one with gcc. */
3/* Copyright (C) 1997 Free Software Foundation, Inc.
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING. If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22/* As a special exception, if you link this library with other files,
23 some of which are compiled with GCC, to produce an executable,
24 this library does not by itself cause the resulting executable
25 to be covered by the GNU General Public License.
26 This exception does not however invalidate any other reasons why
27 the executable file might be covered by the GNU General Public License. */
28
29#ifndef __gthr_h
30#define __gthr_h
31
32/* If this file is compiled with threads support, it must
33 #define __GTHREADS 1
34 to indicate that threads support is present. Also it has define
35 function
36 int __gthread_active_p ()
37 that returns 1 if thread system is active, 0 if not.
38
39 The threads interface must define the following types:
40 __gthread_key_t
41 __gthread_once_t
42 __gthread_mutex_t
43
44 The threads interface must define the following macros:
45
46 __GTHREAD_ONCE_INIT
47 to initialize __gthread_once_t
48 __GTHREAD_MUTEX_INIT
49 to initialize __gthread_mutex_t to get a fast
50 non-recursive mutex.
51
52 The threads interface must define the following static functions:
53
54 int __gthread_once (__gthread_once_t *once, void (*func) ())
55
56 int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))
57 int __gthread_key_delete (__gthread_key_t key)
58
59 int __gthread_key_dtor (__gthread_key_t key, void *ptr)
60
61 void *__gthread_getspecific (__gthread_key_t key)
62 int __gthread_setspecific (__gthread_key_t key, const void *ptr)
63
64 int __gthread_mutex_lock (__gthread_mutex_t *mutex);
65 int __gthread_mutex_trylock (__gthread_mutex_t *mutex);
66 int __gthread_mutex_unlock (__gthread_mutex_t *mutex);
67
68 All functions returning int should return 0 on success, -1 on error.
69
70 Currently supported threads packages are
71 POSIX threads with -D_PTHREADS
72 DCE threads with -D_DCE_THREADS
73 Solaris/UI threads with -D_SOLARIS_THREADS
74*/
75
76/* Check first for thread specific defines. */
77#if _PTHREADS
78#include "gthr-posix.h"
79#elif _DCE_THREADS
80#include "gthr-dce.h"
81#elif _SOLARIS_THREADS
82#include "gthr-solaris.h"
83
84/* Include GTHREAD_FILE if one is defined. */
85#elif SUPPORTS_WEAK && HAVE_GTHR_DEFAULT
86#ifndef GTHREAD_USE_WEAK
87#define GTHREAD_USE_WEAK 1
88#endif
89#include "gthr-default.h"
90
91/* Fallback to single thread definitions. */
92#else
93#include "gthr-single.h"
94#endif
95
96#endif /* not __gthr_h */