Commit 09e361bb by Jakub Jelinek Committed by Jakub Jelinek

gthr-dce.h: Uglify function parameter and local variable names.

	* gthr-dce.h: Uglify function parameter and local variable names.
	* gthr-gnat.h: Likewise.
	* gthr-mipssde.h: Likewise.
	* gthr-nks.h: Likewise.
	* gthr-posix95.h: Likewise.
	* gthr-posix.h: Likewise.
	* gthr-rtems.h: Likewise.
	* gthr-single.h: Likewise.
	* gthr-solaris.h: Likewise.
	* gthr-tpf.h: Likewise.
	* gthr-vxworks.h: Likewise.
	* gthr-win32.h: Likewise.

From-SVN: r144201
parent 70f5fc7c
2009-02-16 Jakub Jelinek <jakub@redhat.com>
* gthr-dce.h: Uglify function parameter and local variable names.
* gthr-gnat.h: Likewise.
* gthr-mipssde.h: Likewise.
* gthr-nks.h: Likewise.
* gthr-posix95.h: Likewise.
* gthr-posix.h: Likewise.
* gthr-rtems.h: Likewise.
* gthr-single.h: Likewise.
* gthr-solaris.h: Likewise.
* gthr-tpf.h: Likewise.
* gthr-vxworks.h: Likewise.
* gthr-win32.h: Likewise.
2009-02-15 H.J. Lu <hongjiu.lu@intel.com>
PR target/39196
......
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
/* Copyright (C) 1997, 1999, 2000, 2001, 2004, 2005
/* Copyright (C) 1997, 1999, 2000, 2001, 2004, 2005, 2008, 2009
Free Software Foundation, Inc.
This file is part of GCC.
......@@ -431,122 +431,123 @@ __gthread_objc_condition_signal (objc_condition_t condition
#else /* _LIBOBJC */
static inline int
__gthread_once (__gthread_once_t *once, void (*func) (void))
__gthread_once (__gthread_once_t *__once, void (*__func) (void))
{
if (__gthread_active_p ())
return __gthrw_(pthread_once) (once, func);
return __gthrw_(pthread_once) (__once, __func);
else
return -1;
}
static inline int
__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
{
return __gthrw_(pthread_keycreate) (key, dtor);
return __gthrw_(pthread_keycreate) (__key, __dtor);
}
static inline int
__gthread_key_delete (__gthread_key_t key __attribute__ ((__unused__)))
__gthread_key_delete (__gthread_key_t __key __attribute__ ((__unused__)))
{
/* Operation is not supported. */
return -1;
}
static inline void *
__gthread_getspecific (__gthread_key_t key)
__gthread_getspecific (__gthread_key_t __key)
{
void *ptr;
if (__gthrw_(pthread_getspecific) (key, &ptr) == 0)
return ptr;
void *__ptr;
if (__gthrw_(pthread_getspecific) (__key, &__ptr) == 0)
return __ptr;
else
return 0;
}
static inline int
__gthread_setspecific (__gthread_key_t key, const void *ptr)
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
return __gthrw_(pthread_setspecific) (key, (void *) ptr);
return __gthrw_(pthread_setspecific) (__key, (void *) __ptr);
}
static inline void
__gthread_mutex_init_function (__gthread_mutex_t *mutex)
__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
__gthrw_(pthread_mutex_init) (mutex, pthread_mutexattr_default);
__gthrw_(pthread_mutex_init) (__mutex, pthread_mutexattr_default);
}
static inline int
__gthread_mutx_destroy (__gthread_mutex_t *mutex)
__gthread_mutx_destroy (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_destroy) (mutex);
return __gthrw_(pthread_mutex_destroy) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
__gthread_mutex_lock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_lock) (mutex);
return __gthrw_(pthread_mutex_lock) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *mutex)
__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_trylock) (mutex);
return __gthrw_(pthread_mutex_trylock) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *mutex)
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_unlock) (mutex);
return __gthrw_(pthread_mutex_unlock) (__mutex);
else
return 0;
}
static inline int
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
pthread_mutexattr_t attr;
int r;
r = __gthrw_(pthread_mutexattr_create) (&attr);
if (!r)
r = __gthrw_(pthread_mutexattr_setkind_np) (&attr, MUTEX_RECURSIVE_NP);
if (!r)
r = __gthrw_(pthread_mutex_init) (mutex, attr);
if (!r)
r = __gthrw_(pthread_mutexattr_delete) (&attr);
return r;
pthread_mutexattr_t __attr;
int __r;
__r = __gthrw_(pthread_mutexattr_create) (&__attr);
if (!__r)
__r = __gthrw_(pthread_mutexattr_setkind_np) (&__attr,
MUTEX_RECURSIVE_NP);
if (!__r)
__r = __gthrw_(pthread_mutex_init) (__mutex, __attr);
if (!__r)
__r = __gthrw_(pthread_mutexattr_delete) (&__attr);
return __r;
}
return 0;
}
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_lock (mutex);
return __gthread_mutex_lock (__mutex);
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_trylock (mutex);
return __gthread_mutex_trylock (__mutex);
}
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_unlock (mutex);
return __gthread_mutex_unlock (__mutex);
}
#endif /* _LIBOBJC */
......
/* Threads compatibility routines for libgcc2. */
/* Compile this one with gcc. */
/* Copyright (C) 2003, 2004 Free Software Foundation, Inc.
/* Copyright (C) 2003, 2004, 2008, 2009 Free Software Foundation, Inc.
This file is part of GCC.
......@@ -38,7 +38,7 @@ typedef int __gthread_mutex_t;
#define __GTHREAD_MUTEX_INIT 0
extern void __gnat_install_locks (void (*lock) (void), void (*unlock) (void));
extern void __gnat_install_locks (void (*) (void), void (*) (void));
extern int __gthread_active_p (void);
extern int __gthread_mutex_lock (__gthread_mutex_t *);
extern int __gthread_mutex_unlock (__gthread_mutex_t *);
......
/* MIPS SDE threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
/* Copyright (C) 2006, 2007 Free Software Foundation, Inc.
/* Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
Contributed by Nigel Stephens <nigel@mips.com>
This file is part of GCC.
......@@ -55,7 +55,7 @@ typedef struct {
#define __GTHREAD_MUTEX_INIT __SDETHREAD_MUTEX_INITIALIZER("gthr")
#define __GTHREAD_ONCE_INIT __SDETHREAD_ONCE_INIT
static inline int
__gthread_recursive_mutex_init_function(__gthread_recursive_mutex_t *mutex);
__gthread_recursive_mutex_init_function(__gthread_recursive_mutex_t *__mutex);
#define __GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION __gthread_recursive_mutex_init_function
#if SUPPORTS_WEAK && GTHREAD_USE_WEAK
......@@ -102,125 +102,125 @@ __gthread_active_p (void)
#endif /* SUPPORTS_WEAK */
static inline int
__gthread_once (__gthread_once_t *once, void (*func) (void))
__gthread_once (__gthread_once_t *__once, void (*__func) (void))
{
if (__gthread_active_p ())
return __gthrw_(__sdethread_once) (once, func);
return __gthrw_(__sdethread_once) (__once, __func);
else
return -1;
}
static inline int
__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
{
return __gthrw_(__sdethread_key_create) (key, dtor);
return __gthrw_(__sdethread_key_create) (__key, __dtor);
}
static inline int
__gthread_key_delete (__gthread_key_t key)
__gthread_key_delete (__gthread_key_t __key)
{
return __gthrw_(__sdethread_key_delete) (key);
return __gthrw_(__sdethread_key_delete) (__key);
}
static inline void *
__gthread_getspecific (__gthread_key_t key)
__gthread_getspecific (__gthread_key_t __key)
{
return __gthrw_(__sdethread_getspecific) (key);
return __gthrw_(__sdethread_getspecific) (__key);
}
static inline int
__gthread_setspecific (__gthread_key_t key, const void *ptr)
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
return __gthrw_(__sdethread_setspecific) (key, ptr);
return __gthrw_(__sdethread_setspecific) (__key, __ptr);
}
static inline int
__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(mutex))
__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(__mutex))
{
return 0;
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
__gthread_mutex_lock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(__sdethread_mutex_lock) (mutex);
return __gthrw_(__sdethread_mutex_lock) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *mutex)
__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(__sdethread_mutex_trylock) (mutex);
return __gthrw_(__sdethread_mutex_trylock) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *mutex)
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(__sdethread_mutex_unlock) (mutex);
return __gthrw_(__sdethread_mutex_unlock) (__mutex);
else
return 0;
}
static inline int
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
{
mutex->depth = 0;
mutex->owner = __gthrw_(__sdethread_self) ();
return __gthrw_(__sdethread_mutex_init) (&mutex->actual, NULL);
__mutex->depth = 0;
__mutex->owner = __gthrw_(__sdethread_self) ();
return __gthrw_(__sdethread_mutex_init) (&__mutex->actual, NULL);
}
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
__sdethread_t me = __gthrw_(__sdethread_self) ();
__sdethread_t __me = __gthrw_(__sdethread_self) ();
if (mutex->owner != me)
if (__mutex->owner != __me)
{
__gthrw_(__sdethread_mutex_lock) (&mutex->actual);
mutex->owner = me;
__gthrw_(__sdethread_mutex_lock) (&__mutex->actual);
__mutex->owner = __me;
}
mutex->depth++;
__mutex->depth++;
}
return 0;
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
__sdethread_t me = __gthrw_(__sdethread_self) ();
__sdethread_t __me = __gthrw_(__sdethread_self) ();
if (mutex->owner != me)
if (__mutex->owner != __me)
{
if (__gthrw_(__sdethread_mutex_trylock) (&mutex->actual))
if (__gthrw_(__sdethread_mutex_trylock) (&__mutex->actual))
return 1;
mutex->owner = me;
__mutex->owner = __me;
}
mutex->depth++;
__mutex->depth++;
}
return 0;
}
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
if (--mutex->depth == 0)
if (--__mutex->depth == 0)
{
mutex->owner = (__sdethread_t) 0;
__gthrw_(__sdethread_mutex_unlock) (&mutex->actual);
__mutex->owner = (__sdethread_t) 0;
__gthrw_(__sdethread_mutex_unlock) (&__mutex->actual);
}
}
return 0;
......
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
/* Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
/* Copyright (C) 2002, 2003, 2004, 2008, 2009 Free Software Foundation, Inc.
This file is part of GCC.
......@@ -281,118 +281,118 @@ typedef volatile long __gthread_once_t;
#define __GTHREAD_ONCE_INIT 0
static inline int
__gthread_once (__gthread_once_t *once, void (*func) (void))
__gthread_once (__gthread_once_t *__once, void (*__func) (void))
{
if (__compare_and_swap (once, 0, 1))
if (__compare_and_swap (__once, 0, 1))
{
func();
*once |= 2;
__func ();
*__once |= 2;
}
else
{
while (!(*once & 2))
while (!(*__once & 2))
NXThreadYield ();
}
return 0;
}
static inline int
__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
{
return NXKeyCreate (dtor, NULL, key);
return NXKeyCreate (__dtor, NULL, __key);
}
static inline int
__gthread_key_dtor (__gthread_key_t key, void *ptr)
__gthread_key_dtor (__gthread_key_t __key, void *__ptr)
{
/* Just reset the key value to zero. */
if (ptr)
return NXKeySetValue (key, NULL);
if (__ptr)
return NXKeySetValue (__key, NULL);
return 0;
}
static inline int
__gthread_key_delete (__gthread_key_t key)
__gthread_key_delete (__gthread_key_t __key)
{
return NXKeyDelete (key);
return NXKeyDelete (__key);
}
static inline void *
__gthread_getspecific (__gthread_key_t key)
__gthread_getspecific (__gthread_key_t __key)
{
void *value;
void *__value;
if (NXKeyGetValue (key, &value) == 0)
return value;
if (NXKeyGetValue (__key, &__value) == 0)
return __value;
return NULL;
}
static inline int
__gthread_setspecific (__gthread_key_t key, const void *ptr)
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
return NXKeySetValue (key, (void *)ptr);
return NXKeySetValue (__key, (void *)__ptr);
}
static inline void
__gthread_mutex_init_function (__gthread_mutex_t *mutex)
__gthread_mutex_init_function (__gthread_mutex_t *__mutex)
{
static const NX_LOCK_INFO_ALLOC (info, "GTHREADS", 0);
static const NX_LOCK_INFO_ALLOC (__info, "GTHREADS", 0);
*mutex = NXMutexAlloc (0, 0, &info);
*__mutex = NXMutexAlloc (0, 0, &__info);
}
static inline int
__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(mutex))
__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(__mutex))
{
return 0;
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
__gthread_mutex_lock (__gthread_mutex_t *__mutex)
{
return NXLock (*mutex);
return NXLock (*__mutex);
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *mutex)
__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
{
if (NXTryLock (*mutex))
if (NXTryLock (*__mutex))
return 0;
return -1;
}
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *mutex)
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
{
return NXUnlock (*mutex);
return NXUnlock (*__mutex);
}
static inline void
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
{
static const NX_LOCK_INFO_ALLOC (info, "GTHREADS", 0);
static const NX_LOCK_INFO_ALLOC (__info, "GTHREADS", 0);
*mutex = NXMutexAlloc (NX_MUTEX_RECURSIVE, 0, &info);
*__mutex = NXMutexAlloc (NX_MUTEX_RECURSIVE, 0, &__info);
}
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
return NXLock (*mutex);
return NXLock (*__mutex);
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
if (NXTryLock (*mutex))
if (NXTryLock (*__mutex))
return 0;
return -1;
}
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
return NXUnlock (*mutex);
return NXUnlock (*__mutex);
}
#endif /* _LIBOBJC */
......
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
/* Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
/* Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
This file is part of GCC.
......@@ -610,150 +610,150 @@ __gthread_objc_condition_signal (objc_condition_t condition)
#else /* _LIBOBJC */
static inline int
__gthread_once (__gthread_once_t *once, void (*func) (void))
__gthread_once (__gthread_once_t *__once, void (*__func) (void))
{
if (__gthread_active_p ())
return __gthrw_(pthread_once) (once, func);
return __gthrw_(pthread_once) (__once, __func);
else
return -1;
}
static inline int
__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
{
return __gthrw_(pthread_key_create) (key, dtor);
return __gthrw_(pthread_key_create) (__key, __dtor);
}
static inline int
__gthread_key_delete (__gthread_key_t key)
__gthread_key_delete (__gthread_key_t __key)
{
return __gthrw_(pthread_key_delete) (key);
return __gthrw_(pthread_key_delete) (__key);
}
static inline void *
__gthread_getspecific (__gthread_key_t key)
__gthread_getspecific (__gthread_key_t __key)
{
return __gthrw_(pthread_getspecific) (key);
return __gthrw_(pthread_getspecific) (__key);
}
static inline int
__gthread_setspecific (__gthread_key_t key, const void *ptr)
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
return __gthrw_(pthread_setspecific) (key, ptr);
return __gthrw_(pthread_setspecific) (__key, __ptr);
}
static inline int
__gthread_mutex_destroy (__gthread_mutex_t *mutex)
__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_destroy) (mutex);
return __gthrw_(pthread_mutex_destroy) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
__gthread_mutex_lock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_lock) (mutex);
return __gthrw_(pthread_mutex_lock) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *mutex)
__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_trylock) (mutex);
return __gthrw_(pthread_mutex_trylock) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *mutex)
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(pthread_mutex_unlock) (mutex);
return __gthrw_(pthread_mutex_unlock) (__mutex);
else
return 0;
}
static inline int
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
{
mutex->depth = 0;
mutex->owner = (pthread_t) 0;
return __gthrw_(pthread_mutex_init) (&mutex->actual, NULL);
__mutex->depth = 0;
__mutex->owner = (pthread_t) 0;
return __gthrw_(pthread_mutex_init) (&__mutex->actual, NULL);
}
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
pthread_t me = __gthrw_(pthread_self) ();
pthread_t __me = __gthrw_(pthread_self) ();
if (mutex->owner != me)
if (__mutex->owner != __me)
{
__gthrw_(pthread_mutex_lock) (&mutex->actual);
mutex->owner = me;
__gthrw_(pthread_mutex_lock) (&__mutex->actual);
__mutex->owner = __me;
}
mutex->depth++;
__mutex->depth++;
}
return 0;
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
pthread_t me = __gthrw_(pthread_self) ();
pthread_t __me = __gthrw_(pthread_self) ();
if (mutex->owner != me)
if (__mutex->owner != __me)
{
if (__gthrw_(pthread_mutex_trylock) (&mutex->actual))
if (__gthrw_(pthread_mutex_trylock) (&__mutex->actual))
return 1;
mutex->owner = me;
__mutex->owner = __me;
}
mutex->depth++;
__mutex->depth++;
}
return 0;
}
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
if (--mutex->depth == 0)
if (--__mutex->depth == 0)
{
mutex->owner = (pthread_t) 0;
__gthrw_(pthread_mutex_unlock) (&mutex->actual);
__mutex->owner = (pthread_t) 0;
__gthrw_(pthread_mutex_unlock) (&__mutex->actual);
}
}
return 0;
}
static inline int
__gthread_cond_broadcast (__gthread_cond_t *cond)
__gthread_cond_broadcast (__gthread_cond_t *__cond)
{
return __gthrw_(pthread_cond_broadcast) (cond);
return __gthrw_(pthread_cond_broadcast) (__cond);
}
static inline int
__gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex)
__gthread_cond_wait (__gthread_cond_t *__cond, __gthread_mutex_t *__mutex)
{
return __gthrw_(pthread_cond_wait) (cond, mutex);
return __gthrw_(pthread_cond_wait) (__cond, __mutex);
}
static inline int
__gthread_cond_wait_recursive (__gthread_cond_t *cond,
__gthread_recursive_mutex_t *mutex)
__gthread_cond_wait_recursive (__gthread_cond_t *__cond,
__gthread_recursive_mutex_t *__mutex)
{
return __gthrw_(pthread_cond_wait) (cond, &mutex->actual);
return __gthrw_(pthread_cond_wait) (__cond, &__mutex->actual);
}
#endif /* _LIBOBJC */
......
/* 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, 2003, 2005
/* Copyright (C) 1997, 1999, 2000, 2002, 2003, 2005, 2008, 2009
Free Software Foundation, Inc.
This file is part of GCC.
......@@ -54,24 +54,24 @@ typedef void *__gthread_recursive_mutex_t;
*/
/* generic per task variables */
extern int rtems_gxx_once (__gthread_once_t *once, void (*func) (void));
extern int rtems_gxx_key_create (__gthread_key_t *key, void (*dtor) (void *));
extern int rtems_gxx_key_delete (__gthread_key_t key);
extern void *rtems_gxx_getspecific (__gthread_key_t key);
extern int rtems_gxx_setspecific (__gthread_key_t key, const void *ptr);
extern int rtems_gxx_once (__gthread_once_t *__once, void (*__func) (void));
extern int rtems_gxx_key_create (__gthread_key_t *__key, void (*__dtor) (void *));
extern int rtems_gxx_key_delete (__gthread_key_t __key);
extern void *rtems_gxx_getspecific (__gthread_key_t __key);
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);
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);
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
......@@ -82,75 +82,75 @@ __gthread_active_p (void)
/* Wrapper calls */
static inline int
__gthread_once (__gthread_once_t *once, void (*func) (void))
__gthread_once (__gthread_once_t *__once, void (*__func) (void))
{
return rtems_gxx_once( once, func );
return rtems_gxx_once( __once, __func );
}
static inline int
__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
{
return rtems_gxx_key_create( key, dtor );
return rtems_gxx_key_create( __key, __dtor );
}
static inline int
__gthread_key_delete (__gthread_key_t key)
__gthread_key_delete (__gthread_key_t __key)
{
return rtems_gxx_key_delete (key);
return rtems_gxx_key_delete (__key);
}
static inline void *
__gthread_getspecific (__gthread_key_t key)
__gthread_getspecific (__gthread_key_t __key)
{
return rtems_gxx_getspecific (key);
return rtems_gxx_getspecific (__key);
}
static inline int
__gthread_setspecific (__gthread_key_t key, const void *ptr)
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
return rtems_gxx_setspecific (key, ptr);
return rtems_gxx_setspecific (__key, __ptr);
}
static inline int
__gthread_mutex_destroy (__gthread_mutex_t *mutex)
__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
{
return rtems_gxx_mutex_destroy (mutex);
return rtems_gxx_mutex_destroy (__mutex);
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
__gthread_mutex_lock (__gthread_mutex_t *__mutex)
{
return rtems_gxx_mutex_lock (mutex);
return rtems_gxx_mutex_lock (__mutex);
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *mutex)
__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
{
return rtems_gxx_mutex_trylock (mutex);
return rtems_gxx_mutex_trylock (__mutex);
}
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *mutex)
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
{
return rtems_gxx_mutex_unlock( mutex );
return rtems_gxx_mutex_unlock( __mutex );
}
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
return rtems_gxx_recursive_mutex_lock (mutex);
return rtems_gxx_recursive_mutex_lock (__mutex);
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
return rtems_gxx_recursive_mutex_trylock (mutex);
return rtems_gxx_recursive_mutex_trylock (__mutex);
}
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
return rtems_gxx_recursive_mutex_unlock( mutex );
return rtems_gxx_recursive_mutex_unlock( __mutex );
}
#ifdef __cplusplus
......
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
/* Copyright (C) 1997, 1999, 2000, 2004, 2008 Free Software Foundation, Inc.
/* Copyright (C) 1997, 1999, 2000, 2004, 2008, 2009
Free Software Foundation, Inc.
This file is part of GCC.
......@@ -216,75 +217,75 @@ __gthread_active_p (void)
}
static inline int
__gthread_once (__gthread_once_t *once UNUSED, void (*func) (void) UNUSED)
__gthread_once (__gthread_once_t *__once UNUSED, void (*__func) (void) UNUSED)
{
return 0;
}
static inline int UNUSED
__gthread_key_create (__gthread_key_t *key UNUSED, void (*func) (void *) UNUSED)
__gthread_key_create (__gthread_key_t *__key UNUSED, void (*__func) (void *) UNUSED)
{
return 0;
}
static int UNUSED
__gthread_key_delete (__gthread_key_t key UNUSED)
__gthread_key_delete (__gthread_key_t __key UNUSED)
{
return 0;
}
static inline void *
__gthread_getspecific (__gthread_key_t key UNUSED)
__gthread_getspecific (__gthread_key_t __key UNUSED)
{
return 0;
}
static inline int
__gthread_setspecific (__gthread_key_t key UNUSED, const void *v UNUSED)
__gthread_setspecific (__gthread_key_t __key UNUSED, const void *__v UNUSED)
{
return 0;
}
static inline int
__gthread_mutex_destroy (__gthread_mutex_t *mutex UNUSED)
__gthread_mutex_destroy (__gthread_mutex_t *__mutex UNUSED)
{
return 0;
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex UNUSED)
__gthread_mutex_lock (__gthread_mutex_t *__mutex UNUSED)
{
return 0;
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *mutex UNUSED)
__gthread_mutex_trylock (__gthread_mutex_t *__mutex UNUSED)
{
return 0;
}
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *mutex UNUSED)
__gthread_mutex_unlock (__gthread_mutex_t *__mutex UNUSED)
{
return 0;
}
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_lock (mutex);
return __gthread_mutex_lock (__mutex);
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_trylock (mutex);
return __gthread_mutex_trylock (__mutex);
}
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
return __gthread_mutex_unlock (mutex);
return __gthread_mutex_unlock (__mutex);
}
#endif /* _LIBOBJC */
......
/* Threads compatibility routines for libgcc2 and libobjc. */
/* Compile this one with gcc. */
/* Copyright (C) 1997, 1999, 2000, 2004, 2005, 2006
/* Copyright (C) 1997, 1999, 2000, 2004, 2005, 2006, 2008, 2009
Free Software Foundation, Inc.
This file is part of GCC.
......@@ -403,154 +403,155 @@ __gthread_objc_condition_signal (objc_condition_t condition)
#else /* _LIBOBJC */
static inline int
__gthread_once (__gthread_once_t *once, void (*func) (void))
__gthread_once (__gthread_once_t *__once, void (*__func) (void))
{
if (! __gthread_active_p ())
return -1;
if (once == 0 || func == 0)
if (__once == 0 || __func == 0)
return EINVAL;
if (once->once == 0)
if (__once->once == 0)
{
int status = __gthrw_(mutex_lock) (&once->mutex);
if (status != 0)
return status;
if (once->once == 0)
int __status = __gthrw_(mutex_lock) (&__once->mutex);
if (__status != 0)
return __status;
if (__once->once == 0)
{
(*func) ();
once->once++;
(*__func) ();
__once->once++;
}
__gthrw_(mutex_unlock) (&once->mutex);
__gthrw_(mutex_unlock) (&__once->mutex);
}
return 0;
}
static inline int
__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
{
/* Solaris 2.5 contains thr_* routines no-op in libc, so test if we actually
got a reasonable key value, and if not, fail. */
*key = (__gthread_key_t)-1;
if (__gthrw_(thr_keycreate) (key, dtor) != 0 || *key == (__gthread_key_t)-1)
*__key = (__gthread_key_t)-1;
if (__gthrw_(thr_keycreate) (__key, __dtor) != 0
|| *__key == (__gthread_key_t)-1)
return -1;
else
return 0;
}
static inline int
__gthread_key_delete (__gthread_key_t UNUSED (key))
__gthread_key_delete (__gthread_key_t UNUSED (__key))
{
/* Not possible. */
return -1;
}
static inline void *
__gthread_getspecific (__gthread_key_t key)
__gthread_getspecific (__gthread_key_t __key)
{
void *ptr;
if (__gthrw_(thr_getspecific) (key, &ptr) == 0)
return ptr;
void *__ptr;
if (__gthrw_(thr_getspecific) (__key, &__ptr) == 0)
return __ptr;
else
return 0;
}
static inline int
__gthread_setspecific (__gthread_key_t key, const void *ptr)
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
return __gthrw_(thr_setspecific) (key, (void *) ptr);
return __gthrw_(thr_setspecific) (__key, (void *) __ptr);
}
static inline int
__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(mutex))
__gthread_mutex_destroy (__gthread_mutex_t * UNUSED(__mutex))
{
if (__gthread_active_p ())
return __gthrw_(mutex_destroy) (mutex);
return __gthrw_(mutex_destroy) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
__gthread_mutex_lock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(mutex_lock) (mutex);
return __gthrw_(mutex_lock) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *mutex)
__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(mutex_trylock) (mutex);
return __gthrw_(mutex_trylock) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *mutex)
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
{
if (__gthread_active_p ())
return __gthrw_(mutex_unlock) (mutex);
return __gthrw_(mutex_unlock) (__mutex);
else
return 0;
}
static inline int
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
{
mutex->depth = 0;
mutex->owner = (thread_t) 0;
return __gthrw_(mutex_init) (&mutex->actual, USYNC_THREAD, 0);
__mutex->depth = 0;
__mutex->owner = (thread_t) 0;
return __gthrw_(mutex_init) (&__mutex->actual, USYNC_THREAD, 0);
}
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
thread_t me = __gthrw_(thr_self) ();
thread_t __me = __gthrw_(thr_self) ();
if (mutex->owner != me)
if (__mutex->owner != __me)
{
__gthrw_(mutex_lock) (&mutex->actual);
mutex->owner = me;
__gthrw_(mutex_lock) (&__mutex->actual);
__mutex->owner = __me;
}
mutex->depth++;
__mutex->depth++;
}
return 0;
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
thread_t me = __gthrw_(thr_self) ();
thread_t __me = __gthrw_(thr_self) ();
if (mutex->owner != me)
if (__mutex->owner != __me)
{
if (__gthrw_(mutex_trylock) (&mutex->actual))
if (__gthrw_(mutex_trylock) (&__mutex->actual))
return 1;
mutex->owner = me;
__mutex->owner = __me;
}
mutex->depth++;
__mutex->depth++;
}
return 0;
}
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
if (__gthread_active_p ())
{
if (--mutex->depth == 0)
if (--__mutex->depth == 0)
{
mutex->owner = (thread_t) 0;
__gthrw_(mutex_unlock) (&mutex->actual);
__mutex->owner = (thread_t) 0;
__gthrw_(mutex_unlock) (&__mutex->actual);
}
}
return 0;
......
/* Threads compatibility routines for libgcc2 and libobjc.
Compile this one with gcc.
Copyright (C) 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 2004, 2005, 2008, 2009 Free Software Foundation, Inc.
This file is part of GCC.
......@@ -101,129 +101,130 @@ __gthread_active_p (void)
}
static inline int
__gthread_once (__gthread_once_t *once, void (*func) (void))
__gthread_once (__gthread_once_t *__once, void (*__func) (void))
{
if (__tpf_pthread_active ())
return __gthrw_(pthread_once) (once, func);
return __gthrw_(pthread_once) (__once, __func);
else
return -1;
}
static inline int
__gthread_key_create (__gthread_key_t *key, void (*dtor) (void *))
__gthread_key_create (__gthread_key_t *__key, void (*__dtor) (void *))
{
if (__tpf_pthread_active ())
return __gthrw_(pthread_key_create) (key, dtor);
return __gthrw_(pthread_key_create) (__key, __dtor);
else
return -1;
}
static inline int
__gthread_key_delete (__gthread_key_t key)
__gthread_key_delete (__gthread_key_t __key)
{
if (__tpf_pthread_active ())
return __gthrw_(pthread_key_delete) (key);
return __gthrw_(pthread_key_delete) (__key);
else
return -1;
}
static inline void *
__gthread_getspecific (__gthread_key_t key)
__gthread_getspecific (__gthread_key_t __key)
{
if (__tpf_pthread_active ())
return __gthrw_(pthread_getspecific) (key);
return __gthrw_(pthread_getspecific) (__key);
else
return NULL;
}
static inline int
__gthread_setspecific (__gthread_key_t key, const void *ptr)
__gthread_setspecific (__gthread_key_t __key, const void *__ptr)
{
if (__tpf_pthread_active ())
return __gthrw_(pthread_setspecific) (key, ptr);
return __gthrw_(pthread_setspecific) (__key, __ptr);
else
return -1;
}
static inline int
__gthread_mutex_destroy (__gthread_mutex_t *mutex)
__gthread_mutex_destroy (__gthread_mutex_t *__mutex)
{
if (__tpf_pthread_active ())
return __gthrw_(pthread_mutex_destroy) (mutex);
return __gthrw_(pthread_mutex_destroy) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_lock (__gthread_mutex_t *mutex)
__gthread_mutex_lock (__gthread_mutex_t *__mutex)
{
if (__tpf_pthread_active ())
return __gthrw_(pthread_mutex_lock) (mutex);
return __gthrw_(pthread_mutex_lock) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_trylock (__gthread_mutex_t *mutex)
__gthread_mutex_trylock (__gthread_mutex_t *__mutex)
{
if (__tpf_pthread_active ())
return __gthrw_(pthread_mutex_trylock) (mutex);
return __gthrw_(pthread_mutex_trylock) (__mutex);
else
return 0;
}
static inline int
__gthread_mutex_unlock (__gthread_mutex_t *mutex)
__gthread_mutex_unlock (__gthread_mutex_t *__mutex)
{
if (__tpf_pthread_active ())
return __gthrw_(pthread_mutex_unlock) (mutex);
return __gthrw_(pthread_mutex_unlock) (__mutex);
else
return 0;
}
static inline int
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *__mutex)
{
if (__tpf_pthread_active ())
return __gthread_mutex_lock (mutex);
return __gthread_mutex_lock (__mutex);
else
return 0;
}
static inline int
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *__mutex)
{
if (__tpf_pthread_active ())
return __gthread_mutex_trylock (mutex);
return __gthread_mutex_trylock (__mutex);
else
return 0;
}
static inline int
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *__mutex)
{
if (__tpf_pthread_active ())
return __gthread_mutex_unlock (mutex);
return __gthread_mutex_unlock (__mutex);
else
return 0;
}
static inline int
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *mutex)
__gthread_recursive_mutex_init_function (__gthread_recursive_mutex_t *__mutex)
{
if (__tpf_pthread_active ())
{
pthread_mutexattr_t attr;
int r;
r = __gthrw_(pthread_mutexattr_init) (&attr);
if (!r)
r = __gthrw_(pthread_mutexattr_settype) (&attr, PTHREAD_MUTEX_RECURSIVE);
if (!r)
r = __gthrw_(pthread_mutex_init) (mutex, &attr);
if (!r)
r = __gthrw_(pthread_mutexattr_destroy) (&attr);
return r;
pthread_mutexattr_t __attr;
int __r;
__r = __gthrw_(pthread_mutexattr_init) (&__attr);
if (!__r)
__r = __gthrw_(pthread_mutexattr_settype) (&__attr,
PTHREAD_MUTEX_RECURSIVE);
if (!__r)
__r = __gthrw_(pthread_mutex_init) (__mutex, &__attr);
if (!__r)
__r = __gthrw_(pthread_mutexattr_destroy) (&__attr);
return __r;
}
return 0;
}
......
/* Threads compatibility routines for libgcc2 and libobjc for VxWorks. */
/* Compile this one with gcc. */
/* Copyright (C) 1997, 1999, 2000 Free Software Foundation, Inc.
/* Copyright (C) 1997, 1999, 2000, 2008, 2009 Free Software Foundation, Inc.
Contributed by Mike Stump <mrs@wrs.com>.
This file is part of GCC.
......@@ -131,7 +131,7 @@ __gthread_once_t;
# define __GTHREAD_ONCE_INIT { 0 }
#endif
extern int __gthread_once (__gthread_once_t *once, void (*func)(void));
extern int __gthread_once (__gthread_once_t *__once, void (*__func)(void));
/* Thread-specific data requires a great deal of effort, since VxWorks
is not really set up for it. See config/vxlib.c for the gory
......@@ -140,11 +140,11 @@ extern int __gthread_once (__gthread_once_t *once, void (*func)(void));
typedef unsigned int __gthread_key_t;
extern int __gthread_key_create (__gthread_key_t *keyp, void (*dtor)(void *));
extern int __gthread_key_delete (__gthread_key_t key);
extern int __gthread_key_create (__gthread_key_t *__keyp, void (*__dtor)(void *));
extern int __gthread_key_delete (__gthread_key_t __key);
extern void *__gthread_getspecific (__gthread_key_t key);
extern int __gthread_setspecific (__gthread_key_t key, void *ptr);
extern void *__gthread_getspecific (__gthread_key_t __key);
extern int __gthread_setspecific (__gthread_key_t __key, void *__ptr);
#undef UNUSED
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment