diff options
author | Ralf Corsepius <ralf.corsepius@rtems.org> | 2005-01-14 05:03:32 +0000 |
---|---|---|
committer | Ralf Corsepius <ralf.corsepius@rtems.org> | 2005-01-14 05:03:32 +0000 |
commit | e8ece0b49482143401db58ac8491fe7b3ee8f546 (patch) | |
tree | c5b155bc302882dd3adf5b4aa53bfee3494c9b86 /cpukit/libcsupport | |
parent | 2004-12-10 Ralf Corsepius <ralf.corsepius@rtems.org> (diff) | |
download | rtems-e8ece0b49482143401db58ac8491fe7b3ee8f546.tar.bz2 |
2005-01-14 Ralf Corsepius <ralf.corsepius@rtems.org>
* src/gxx_wrappers.c: Backport from trunk. Add support for GCC-4.0.
Diffstat (limited to 'cpukit/libcsupport')
-rw-r--r-- | cpukit/libcsupport/ChangeLog | 4 | ||||
-rw-r--r-- | cpukit/libcsupport/src/gxx_wrappers.c | 40 |
2 files changed, 37 insertions, 7 deletions
diff --git a/cpukit/libcsupport/ChangeLog b/cpukit/libcsupport/ChangeLog index 5d0bab0625..f0e4fac139 100644 --- a/cpukit/libcsupport/ChangeLog +++ b/cpukit/libcsupport/ChangeLog @@ -1,3 +1,7 @@ +2005-01-14 Ralf Corsepius <ralf.corsepius@rtems.org> + + * src/gxx_wrappers.c: Backport from trunk. Add support for GCC-4.0. + 2004-01-12 Ralf Corsepius <corsepiu@faw.uni-ulm.de> PR 548/rtems diff --git a/cpukit/libcsupport/src/gxx_wrappers.c b/cpukit/libcsupport/src/gxx_wrappers.c index d660a6f226..e6a3424698 100644 --- a/cpukit/libcsupport/src/gxx_wrappers.c +++ b/cpukit/libcsupport/src/gxx_wrappers.c @@ -13,9 +13,14 @@ * Eric sent some e-mail in the rtems-list as a start point for this * module implementation. * - * + * $Id$ */ +/* + * This file is only used if using gcc + */ +#if defined(__GNUC__) + #if HAVE_CONFIG_H #include "config.h" #endif @@ -32,14 +37,14 @@ #include <rtems/error.h> /* rtems_panic */ #include <rtems/rtems/tasks.h> -/* +/* * These typedefs should match with the ones defined in the file * gcc/gthr-rtems.h in the gcc distribution. */ typedef void *__gthread_key_t; typedef int __gthread_once_t; typedef void *__gthread_mutex_t; - +typedef void *__gthread_recursive_mutex_t; /* uncomment this if you need to debug this interface */ @@ -51,7 +56,7 @@ typedef void *__gthread_mutex_t; /* local function to return the ID of the calling thread */ static rtems_id get_tid( void ) { - rtems_id id = 0; + rtems_id id = 0; rtems_task_ident( RTEMS_SELF, 0, &id ); return id; } @@ -82,7 +87,7 @@ int rtems_gxx_key_create (__gthread_key_t *key, void (*dtor) (void *)) { /* Ok, this can be a bit tricky. We are going to return a "key" as a * pointer to the buffer that will hold the value of the key itself. - * We have to to this, becuase the others functions on this interface + * We have to to this, because the others functions on this interface * deal with the value of the key, as used with the POSIX API. */ /* Do not pull your hair, trust me this works. :-) */ @@ -195,7 +200,7 @@ int rtems_gxx_mutex_lock (__gthread_mutex_t *mutex) #ifdef DEBUG_GXX_WRAPPERS printk( "gxx_wrappers: lock mutex=%X\n", *mutex ); #endif - return ( rtems_semaphore_obtain( (rtems_id)*mutex, + return ( rtems_semaphore_obtain( (rtems_id)*mutex, RTEMS_WAIT, RTEMS_NO_TIMEOUT ) == RTEMS_SUCCESSFUL) ? 0 : -1; } @@ -204,7 +209,7 @@ int rtems_gxx_mutex_trylock (__gthread_mutex_t *mutex) #ifdef DEBUG_GXX_WRAPPERS printk( "gxx_wrappers: trylock mutex=%X\n", *mutex ); #endif - return (rtems_semaphore_obtain ((rtems_id)*mutex, + return (rtems_semaphore_obtain ((rtems_id)*mutex, RTEMS_NO_WAIT, 0) == RTEMS_SUCCESSFUL) ? 0 : -1; } @@ -216,3 +221,24 @@ int rtems_gxx_mutex_unlock (__gthread_mutex_t *mutex) return (rtems_semaphore_release( (rtems_id)*mutex ) == RTEMS_SUCCESSFUL) ? 0 :-1; } +void rtems_gxx_recursive_mutex_init_function(__gthread_recursive_mutex_t *mutex) +{ + rtems_gxx_mutex_init(mutex); +} + +int rtems_gxx_recursive_mutex_lock(__gthread_recursive_mutex_t *mutex) +{ + return rtems_gxx_mutex_lock(mutex); +} + +int rtems_gxx_recursive_mutex_trylock(__gthread_recursive_mutex_t *mutex) +{ + return rtems_gxx_mutex_trylock(mutex); +} + +int rtems_gxx_recursive_mutex_unlock(__gthread_recursive_mutex_t *mutex) +{ + return rtems_gxx_mutex_unlock(mutex); +} + +#endif /* __GNUC__ */ |