am a02b93bd: libc: add sanity checks to pthread_mutex_destroy()
Merge commit 'a02b93bd75a9d156117264d88069566e447397e2' into gingerbread-plus-aosp * commit 'a02b93bd75a9d156117264d88069566e447397e2': libc: add sanity checks to pthread_mutex_destroy()
This commit is contained in:
commit
7d1d98b97e
@ -880,8 +880,13 @@ int pthread_mutex_init(pthread_mutex_t *mutex,
|
|||||||
|
|
||||||
int pthread_mutex_destroy(pthread_mutex_t *mutex)
|
int pthread_mutex_destroy(pthread_mutex_t *mutex)
|
||||||
{
|
{
|
||||||
if (__unlikely(mutex == NULL))
|
int ret;
|
||||||
return EINVAL;
|
|
||||||
|
/* use trylock to ensure that the mutex value is
|
||||||
|
* valid and is not already locked. */
|
||||||
|
ret = pthread_mutex_trylock(mutex);
|
||||||
|
if (ret != 0)
|
||||||
|
return ret;
|
||||||
|
|
||||||
mutex->value = 0xdead10cc;
|
mutex->value = 0xdead10cc;
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -3,7 +3,9 @@ Bionic ChangeLog:
|
|||||||
|
|
||||||
Differences between current and Android 2.2:
|
Differences between current and Android 2.2:
|
||||||
|
|
||||||
- <pthread.h>: Add reader/writer locks implementation.
|
- <pthread.h>: Add reader/writer locks implementation. Add sanity
|
||||||
|
checking to pthread_mutex_destroy() (e.g. a locked mutex will return
|
||||||
|
EBUSY).
|
||||||
|
|
||||||
- <semaphore.h>: Use private futexes for semaphore implementation,
|
- <semaphore.h>: Use private futexes for semaphore implementation,
|
||||||
unless your set 'pshared' to non-0 when calling sem_init().
|
unless your set 'pshared' to non-0 when calling sem_init().
|
||||||
|
Loading…
x
Reference in New Issue
Block a user