]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/gthr-rtems.h
Makefile.in, [...]: replace "GNU CC" with "GCC".
[thirdparty/gcc.git] / gcc / gthr-rtems.h
CommitLineData
bc98ef7f
JS
1/* RTEMS threads compatibily routines for libgcc2 and libobjc.
2 by: Rosimildo da Silva( rdasilva@connecttel.com ) */
3/* Compile this one with gcc. */
4/* Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
5
1322177d 6This file is part of GCC.
bc98ef7f 7
1322177d
LB
8GCC is free software; you can redistribute it and/or modify it under
9the terms of the GNU General Public License as published by the Free
10Software Foundation; either version 2, or (at your option) any later
11version.
bc98ef7f 12
1322177d
LB
13GCC is distributed in the hope that it will be useful, but WITHOUT ANY
14WARRANTY; without even the implied warranty of MERCHANTABILITY or
15FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16for more details.
bc98ef7f
JS
17
18You should have received a copy of the GNU General Public License
1322177d
LB
19along with GCC; see the file COPYING. If not, write to the Free
20Software Foundation, 59 Temple Place - Suite 330, Boston, MA
2102111-1307, USA. */
bc98ef7f
JS
22
23/* As a special exception, if you link this library with other files,
24 some of which are compiled with GCC, to produce an executable,
25 this library does not by itself cause the resulting executable
26 to be covered by the GNU General Public License.
27 This exception does not however invalidate any other reasons why
28 the executable file might be covered by the GNU General Public License. */
29
88657302
RH
30#ifndef GCC_GTHR_RTEMS_H
31#define GCC_GTHR_RTEMS_H
bc98ef7f
JS
32
33
34#define __GTHREADS 1
35
36#define __GTHREAD_ONCE_INIT 0
37#define __GTHREAD_MUTEX_INIT_FUNCTION rtems_gxx_mutex_init
38
39/* avoid depedency on rtems specific headers */
40typedef void *__gthread_key_t;
41typedef int __gthread_once_t;
42typedef void *__gthread_mutex_t;
43
44/*
45 * External functions provided by RTEMS. They are very similar to their POSIX
46 * counterparts. A "Wrapper API" is being use to avoid dependency on any RTEMS
47 * header files.
48 */
49
50/* generic per task variables */
51extern int rtems_gxx_once (__gthread_once_t *once, void (*func) ());
52extern int rtems_gxx_key_create (__gthread_key_t *key, void (*dtor) (void *));
53extern int rtems_gxx_key_dtor (__gthread_key_t key, void *ptr);
54extern int rtems_gxx_key_delete (__gthread_key_t key);
55extern void *rtems_gxx_getspecific (__gthread_key_t key);
56extern int rtems_gxx_setspecific (__gthread_key_t key, const void *ptr);
57
58/* mutex support */
59extern void rtems_gxx_mutex_init (__gthread_mutex_t *mutex);
60extern int rtems_gxx_mutex_lock (__gthread_mutex_t *mutex);
61extern int rtems_gxx_mutex_trylock (__gthread_mutex_t *mutex);
62extern int rtems_gxx_mutex_unlock (__gthread_mutex_t *mutex);
63
64
e08f13ee
JS
65/* RTEMS threading is always active */
66static inline int
67__gthread_active_p (void)
68{
69 return 1;
70}
71
bc98ef7f
JS
72/* Wrapper calls */
73static inline int
74__gthread_once (__gthread_once_t *once, void (*func) ())
75{
76 return rtems_gxx_once( once, func );
77}
78
79static inline int
80__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
81{
82 return rtems_gxx_key_create( key, dtor );
83}
84
85static inline int
86__gthread_key_dtor (__gthread_key_t key, void *ptr)
87{
88 return rtems_gxx_key_dtor(key, ptr);
89}
90
91static inline int
92__gthread_key_delete (__gthread_key_t key)
93{
94 return rtems_gxx_key_delete (key);
95}
96
97static inline void *
98__gthread_getspecific (__gthread_key_t key)
99{
100 return rtems_gxx_getspecific (key);
101}
102
103static inline int
104__gthread_setspecific (__gthread_key_t key, const void *ptr)
105{
106 return rtems_gxx_setspecific (key, ptr);
107}
108
109static inline int
110__gthread_mutex_lock (__gthread_mutex_t *mutex)
111{
112 return rtems_gxx_mutex_lock (mutex);
113}
114
115static inline int
116__gthread_mutex_trylock (__gthread_mutex_t *mutex)
117{
118 return rtems_gxx_mutex_trylock (mutex);
119}
120
121static inline int
122__gthread_mutex_unlock (__gthread_mutex_t *mutex)
123{
124 return rtems_gxx_mutex_unlock( mutex );
125}
126
88657302 127#endif /* ! GCC_GTHR_RTEMS_H */