diff options
| author | nicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-07-18 11:21:20 +0000 |
|---|---|---|
| committer | nicola <nicola@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-07-18 11:21:20 +0000 |
| commit | 273f030cfbba266303b3eede2548badcc2197452 (patch) | |
| tree | 9fb7c2439676b7cfad96f8c55498f71f3ceb5db7 | |
| parent | 8357d3c2d77c9a177be7b6605e71507ae552322e (diff) | |
| download | ppe42-gcc-273f030cfbba266303b3eede2548badcc2197452.tar.gz ppe42-gcc-273f030cfbba266303b3eede2548badcc2197452.zip | |
Fixed backend function of objc_mutex_trylock which was broken
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44104 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/gthr-posix.h | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/gcc/gthr-posix.h b/gcc/gthr-posix.h index 8981eb66732..c047e559823 100644 --- a/gcc/gthr-posix.h +++ b/gcc/gthr-posix.h @@ -331,30 +331,39 @@ __gthread_objc_mutex_deallocate(objc_mutex_t mutex) static inline int __gthread_objc_mutex_lock(objc_mutex_t mutex) { - if (__gthread_active_p ()) - return pthread_mutex_lock((pthread_mutex_t *)mutex->backend); - else - return 0; + if (__gthread_active_p () + && pthread_mutex_lock((pthread_mutex_t *)mutex->backend) != 0) + { + return -1; + } + + return 0; } /* Try to grab a lock on a mutex. */ static inline int __gthread_objc_mutex_trylock(objc_mutex_t mutex) { - if (__gthread_active_p ()) - return pthread_mutex_trylock((pthread_mutex_t *)mutex->backend); - else - return 0; + if (__gthread_active_p () + && pthread_mutex_trylock((pthread_mutex_t *)mutex->backend) != 0) + { + return -1; + } + + return 0; } /* Unlock the mutex */ static inline int __gthread_objc_mutex_unlock(objc_mutex_t mutex) { - if (__gthread_active_p ()) - return pthread_mutex_unlock((pthread_mutex_t *)mutex->backend); - else - return 0; + if (__gthread_active_p () + && pthread_mutex_unlock((pthread_mutex_t *)mutex->backend) != 0) + { + return -1; + } + + return 0; } /* Backend condition mutex functions */ |

