]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/gthr.h
* config/rs6000/rs6000-protos.h (expand_block_clear): Declare.
[thirdparty/gcc.git] / gcc / gthr.h
CommitLineData
00a2e859 1/* Threads compatibility routines for libgcc2. */
58febf9e 2/* Compile this one with gcc. */
2022c24b 3/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
58febf9e 4
f12b58b3 5This file is part of GCC.
58febf9e 6
f12b58b3 7GCC is free software; you can redistribute it and/or modify it under
8the terms of the GNU General Public License as published by the Free
9Software Foundation; either version 2, or (at your option) any later
10version.
58febf9e 11
f12b58b3 12GCC is distributed in the hope that it will be useful, but WITHOUT ANY
13WARRANTY; without even the implied warranty of MERCHANTABILITY or
14FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15for more details.
58febf9e 16
17You should have received a copy of the GNU General Public License
f12b58b3 18along with GCC; see the file COPYING. If not, write to the Free
19Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2002111-1307, USA. */
58febf9e 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
2a281353 29#ifndef GCC_GTHR_H
30#define GCC_GTHR_H
58febf9e 31
bc9fbf5d 32#pragma GCC visibility push(default)
33
58febf9e 34/* If this file is compiled with threads support, it must
35 #define __GTHREADS 1
36 to indicate that threads support is present. Also it has define
3cfec666 37 function
58febf9e 38 int __gthread_active_p ()
39 that returns 1 if thread system is active, 0 if not.
40
41 The threads interface must define the following types:
42 __gthread_key_t
43 __gthread_once_t
44 __gthread_mutex_t
45
46 The threads interface must define the following macros:
47
48 __GTHREAD_ONCE_INIT
49 to initialize __gthread_once_t
50 __GTHREAD_MUTEX_INIT
51 to initialize __gthread_mutex_t to get a fast
52 non-recursive mutex.
2022c24b 53 __GTHREAD_MUTEX_INIT_FUNCTION
dd5b4b36 54 some systems can't initialize a mutex without a
2022c24b 55 function call. On such systems, define this to a
56 function which looks like this:
57 void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)
58 Don't define __GTHREAD_MUTEX_INIT in this case
58febf9e 59
60 The threads interface must define the following static functions:
61
62 int __gthread_once (__gthread_once_t *once, void (*func) ())
63
64 int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))
65 int __gthread_key_delete (__gthread_key_t key)
66
58febf9e 67 void *__gthread_getspecific (__gthread_key_t key)
68 int __gthread_setspecific (__gthread_key_t key, const void *ptr)
69
70 int __gthread_mutex_lock (__gthread_mutex_t *mutex);
71 int __gthread_mutex_trylock (__gthread_mutex_t *mutex);
72 int __gthread_mutex_unlock (__gthread_mutex_t *mutex);
73
f8809366 74 All functions returning int should return zero on success or the error
75 number. If the operation is not supported, -1 is returned.
58febf9e 76
77 Currently supported threads packages are
78 POSIX threads with -D_PTHREADS
79 DCE threads with -D_DCE_THREADS
80 Solaris/UI threads with -D_SOLARIS_THREADS
81*/
82
ab6d34f7 83/* Check first for thread specific defines. */
58febf9e 84#if _PTHREADS
85#include "gthr-posix.h"
86#elif _DCE_THREADS
87#include "gthr-dce.h"
88#elif _SOLARIS_THREADS
89#include "gthr-solaris.h"
90
ab6d34f7 91/* Include GTHREAD_FILE if one is defined. */
26fbb0d3 92#elif defined(HAVE_GTHR_DEFAULT)
93#if SUPPORTS_WEAK
58febf9e 94#ifndef GTHREAD_USE_WEAK
95#define GTHREAD_USE_WEAK 1
96#endif
26fbb0d3 97#endif
58febf9e 98#include "gthr-default.h"
99
ab6d34f7 100/* Fallback to single thread definitions. */
58febf9e 101#else
102#include "gthr-single.h"
103#endif
104
bc9fbf5d 105#pragma GCC visibility pop(default)
106
2a281353 107#endif /* ! GCC_GTHR_H */