]> granicus.if.org Git - gc/commit
Fix missing error handling of pthreads_mutex_init and cond_wait
authorIvan Maidanski <ivmai@mail.ru>
Sat, 27 Sep 2014 15:30:06 +0000 (19:30 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 12 May 2015 08:56:44 +0000 (11:56 +0300)
commite82e7232349447c46b7bb64d4309d400a91bbf8f
tree829e9828c18b5746289105dc2cefb400e52ff60e
parente91ab29a65c752db83d33edd3a54a1e4aac49b3c
Fix missing error handling of pthreads_mutex_init and cond_wait

* include/private/darwin_semaphore.h (sem_init): Destroy sem->mutex if
sem->cond initialization failed.
* include/private/darwin_semaphore.h (sem_post): Ignore
pthread_mutex_unlock result in case of pthread_cond_signal.
* include/private/darwin_semaphore.h (sem_wait): Unlock mutex and
return error (-1) if pthread_cond_wait failed.
* include/private/darwin_semaphore.h (sem_init): If pshared then
return -1 (with the appropriate errno code set) instead of ABORT.
* include/private/darwin_semaphore.h (sem_init, sem_post, sem_wait):
Treat non-zero value returned by pthread functions as error (instead
of only negative values).
* include/private/darwin_semaphore.h (sem_init, sem_post, sem_wait):
Reformat code.
* misc.c (GC_init): Abort (with the appropriate message) if
pthread_mutex[attr]_init failed (SN_TARGET_PS3 case only).
* specific.c (GC_key_create_inner): If pthread_mutex_init failed then
return its error code.
include/private/darwin_semaphore.h
misc.c
specific.c