diff options
author | kazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-06-04 11:30:46 +0000 |
---|---|---|
committer | kazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-06-04 11:30:46 +0000 |
commit | 3cfec666406d71f8b7d7abcf9883c64117453c15 (patch) | |
tree | e46147f472cc001827083ec7631a1140948ce7c6 /gcc/gthr-posix.h | |
parent | a2dd943a80f4e3091f7f992594f6e3e01ce522fb (diff) | |
download | gcc-3cfec666406d71f8b7d7abcf9883c64117453c15.tar.gz |
* gbl-ctors.h: Fix formatting.
* gcc.c: Likewise.
* gccspec.c: Likewise.
* gcov.c: Likewise.
* gcov-io.h: Likewise.
* gcse.c: Likewise.
* ggc-common.c: Likewise.
* ggc.h: Likewise.
* ggc-page.c: Likewise.
* ggc-simple.c: Likewise.
* global.c: Likewise.
* graph.h: Likewise.
* gthr-dce.h: Likewise.
* gthr.h: Likewise.
* gthr-posix.h: Likewise.
* gthr-rtems.h: Likewise.
* gthr-solaris.h: Likewise.
* gthr-win32.h: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54240 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gthr-posix.h')
-rw-r--r-- | gcc/gthr-posix.h | 76 |
1 files changed, 38 insertions, 38 deletions
diff --git a/gcc/gthr-posix.h b/gcc/gthr-posix.h index 58bfcb36872..ecd4f97fd6e 100644 --- a/gcc/gthr-posix.h +++ b/gcc/gthr-posix.h @@ -52,9 +52,9 @@ typedef pthread_mutex_t __gthread_mutex_t; #pragma weak pthread_setspecific #pragma weak pthread_create -#pragma weak pthread_mutex_lock -#pragma weak pthread_mutex_trylock -#pragma weak pthread_mutex_unlock +#pragma weak pthread_mutex_lock +#pragma weak pthread_mutex_trylock +#pragma weak pthread_mutex_unlock #ifdef _LIBOBJC /* Objective C. */ @@ -120,15 +120,15 @@ __gthread_objc_init_thread_system(void) { /* Initialize the thread storage key */ if (pthread_key_create(&_objc_thread_storage, NULL) == 0) - { - /* The normal default detach state for threads is - * PTHREAD_CREATE_JOINABLE which causes threads to not die - * when you think they should. */ - if (pthread_attr_init(&_objc_thread_attribs) == 0 - && pthread_attr_setdetachstate(&_objc_thread_attribs, - PTHREAD_CREATE_DETACHED) == 0) - return 0; - } + { + /* The normal default detach state for threads is + * PTHREAD_CREATE_JOINABLE which causes threads to not die + * when you think they should. */ + if (pthread_attr_init(&_objc_thread_attribs) == 0 + && pthread_attr_setdetachstate(&_objc_thread_attribs, + PTHREAD_CREATE_DETACHED) == 0) + return 0; + } } return -1; @@ -157,12 +157,12 @@ __gthread_objc_thread_detach(void (*func)(void *), void *arg) if (!__gthread_active_p ()) return NULL; - + if ( !(pthread_create(&new_thread_handle, NULL, (void *)func, arg)) ) thread_id = (objc_thread_t) new_thread_handle; else thread_id = NULL; - + return thread_id; } @@ -180,25 +180,25 @@ __gthread_objc_thread_set_priority(int priority) if (pthread_getschedparam(thread_id, &policy, ¶ms) == 0) { - if ((priority_max = sched_get_priority_max(policy)) != 0) - return -1; - - if ((priority_min = sched_get_priority_min(policy)) != 0) - return -1; - - if (priority > priority_max) - priority = priority_max; - else if (priority < priority_min) - priority = priority_min; - params.sched_priority = priority; - - /* - * The solaris 7 and several other man pages incorrectly state that - * this should be a pointer to policy but pthread.h is universally - * at odds with this. - */ - if (pthread_setschedparam(thread_id, policy, ¶ms) == 0) - return 0; + if ((priority_max = sched_get_priority_max(policy)) != 0) + return -1; + + if ((priority_min = sched_get_priority_min(policy)) != 0) + return -1; + + if (priority > priority_max) + priority = priority_max; + else if (priority < priority_min) + priority = priority_min; + params.sched_priority = priority; + + /* + * The solaris 7 and several other man pages incorrectly state that + * this should be a pointer to policy but pthread.h is universally + * at odds with this. + */ + if (pthread_setschedparam(thread_id, policy, ¶ms) == 0) + return 0; } return -1; } @@ -214,9 +214,9 @@ __gthread_objc_thread_get_priority(void) struct sched_param params; if (pthread_getschedparam(pthread_self(), &policy, ¶ms) == 0) - return params.sched_priority; + return params.sched_priority; else - return -1; + return -1; } else return OBJC_THREAD_INTERACTIVE_PRIORITY; @@ -330,7 +330,7 @@ __gthread_objc_mutex_deallocate(objc_mutex_t mutex) static inline int __gthread_objc_mutex_lock(objc_mutex_t mutex) { - if (__gthread_active_p () + if (__gthread_active_p () && pthread_mutex_lock((pthread_mutex_t *)mutex->backend) != 0) { return -1; @@ -343,7 +343,7 @@ __gthread_objc_mutex_lock(objc_mutex_t mutex) static inline int __gthread_objc_mutex_trylock(objc_mutex_t mutex) { - if (__gthread_active_p () + if (__gthread_active_p () && pthread_mutex_trylock((pthread_mutex_t *)mutex->backend) != 0) { return -1; @@ -356,7 +356,7 @@ __gthread_objc_mutex_trylock(objc_mutex_t mutex) static inline int __gthread_objc_mutex_unlock(objc_mutex_t mutex) { - if (__gthread_active_p () + if (__gthread_active_p () && pthread_mutex_unlock((pthread_mutex_t *)mutex->backend) != 0) { return -1; |