OSDN Git Service

2008-04-30 Paul Thomas <pault@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / gthr-rtems.h
index 30cb625..e926d53 100644 (file)
@@ -1,7 +1,8 @@
 /* RTEMS threads compatibility routines for libgcc2 and libobjc.
    by: Rosimildo da Silva( rdasilva@connecttel.com ) */
 /* Compile this one with gcc.  */
-/* Copyright (C) 1997, 1999, 2000, 2002 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1999, 2000, 2002, 2003, 2005 
+   Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -17,8 +18,8 @@ for more details.
 
 You should have received a copy of the GNU General Public License
 along with GCC; see the file COPYING.  If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.  */
+Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
+02110-1301, USA.  */
 
 /* As a special exception, if you link this library with other files,
    some of which are compiled with GCC, to produce an executable,
@@ -38,11 +39,13 @@ extern "C" {
 
 #define __GTHREAD_ONCE_INIT  0
 #define __GTHREAD_MUTEX_INIT_FUNCTION  rtems_gxx_mutex_init
+#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION  rtems_gxx_recursive_mutex_init
 
 /* Avoid dependency on rtems specific headers.  */
 typedef void *__gthread_key_t;
 typedef int   __gthread_once_t;
 typedef void *__gthread_mutex_t;
+typedef void *__gthread_recursive_mutex_t;
 
 /*
  * External functions provided by RTEMS. They are very similar to their POSIX
@@ -59,10 +62,16 @@ extern int rtems_gxx_setspecific (__gthread_key_t key, const void *ptr);
 
 /* mutex support */
 extern void rtems_gxx_mutex_init (__gthread_mutex_t *mutex);
+extern int rtems_gxx_mutex_destroy (__gthread_mutex_t *mutex);
 extern int rtems_gxx_mutex_lock (__gthread_mutex_t *mutex);
 extern int rtems_gxx_mutex_trylock (__gthread_mutex_t *mutex);
 extern int rtems_gxx_mutex_unlock (__gthread_mutex_t *mutex);
 
+/* recursive mutex support */
+extern void rtems_gxx_recursive_mutex_init (__gthread_recursive_mutex_t *mutex);
+extern int rtems_gxx_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex);
+extern int rtems_gxx_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex);
+extern int rtems_gxx_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex);
 
 /* RTEMS threading is always active */
 static inline int
@@ -103,6 +112,12 @@ __gthread_setspecific (__gthread_key_t key, const void *ptr)
 }
 
 static inline int
+__gthread_mutex_destroy (__gthread_mutex_t *mutex)
+{
+  return rtems_gxx_mutex_destroy (mutex);
+}
+
+static inline int
 __gthread_mutex_lock (__gthread_mutex_t *mutex)
 {
     return rtems_gxx_mutex_lock (mutex);
@@ -120,6 +135,24 @@ __gthread_mutex_unlock (__gthread_mutex_t *mutex)
     return rtems_gxx_mutex_unlock( mutex );
 }
 
+static inline int
+__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
+{
+    return rtems_gxx_recursive_mutex_lock (mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
+{
+    return rtems_gxx_recursive_mutex_trylock (mutex);
+}
+
+static inline int
+__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
+{
+    return rtems_gxx_recursive_mutex_unlock( mutex );
+}
+
 #ifdef __cplusplus
 }
 #endif