diff options
author | rpj <rpj> | 2004-05-17 01:38:02 +0000 |
---|---|---|
committer | rpj <rpj> | 2004-05-17 01:38:02 +0000 |
commit | 771465fed0cf50ee2dd790723245fc091699c324 (patch) | |
tree | d8c18d095a33fe7c4564bd90c5f313bb9e4057dd /pthread_mutex_destroy.c | |
parent | 8b14911744f58cbe3730703f3fcc41cd969fd0f3 (diff) |
re-indentation, bug fixes, hooks for pre-emptive async cancelation
Diffstat (limited to 'pthread_mutex_destroy.c')
-rw-r--r-- | pthread_mutex_destroy.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/pthread_mutex_destroy.c b/pthread_mutex_destroy.c index 68a24c5..d23af53 100644 --- a/pthread_mutex_destroy.c +++ b/pthread_mutex_destroy.c @@ -39,13 +39,12 @@ int -pthread_mutex_destroy(pthread_mutex_t *mutex) +pthread_mutex_destroy (pthread_mutex_t * mutex) { int result = 0; pthread_mutex_t mx; - if (mutex == NULL - || *mutex == NULL) + if (mutex == NULL || *mutex == NULL) { return EINVAL; } @@ -57,7 +56,7 @@ pthread_mutex_destroy(pthread_mutex_t *mutex) { mx = *mutex; - result = pthread_mutex_trylock(&mx); + result = pthread_mutex_trylock (&mx); /* * If trylock succeeded and the mutex is not recursively locked it @@ -80,13 +79,13 @@ pthread_mutex_destroy(pthread_mutex_t *mutex) */ *mutex = NULL; - result = pthread_mutex_unlock(&mx); + result = pthread_mutex_unlock (&mx); if (result == 0) { - (void) sem_destroy( &mx->wait_sema ); - DeleteCriticalSection( &mx->wait_cs ); - free(mx); + (void) sem_destroy (&mx->wait_sema); + DeleteCriticalSection (&mx->wait_cs); + free (mx); } else { @@ -96,12 +95,12 @@ pthread_mutex_destroy(pthread_mutex_t *mutex) *mutex = mx; } } - else /* mx->recursive_count > 1 */ + else /* mx->recursive_count > 1 */ { /* * The mutex must be recursive and already locked by us (this thread). */ - mx->recursive_count--; /* Undo effect of pthread_mutex_trylock() above */ + mx->recursive_count--; /* Undo effect of pthread_mutex_trylock() above */ result = EBUSY; } } @@ -111,7 +110,7 @@ pthread_mutex_destroy(pthread_mutex_t *mutex) /* * See notes in ptw32_mutex_check_need_init() above also. */ - EnterCriticalSection(&ptw32_mutex_test_init_lock); + EnterCriticalSection (&ptw32_mutex_test_init_lock); /* * Check again. @@ -135,8 +134,8 @@ pthread_mutex_destroy(pthread_mutex_t *mutex) result = EBUSY; } - LeaveCriticalSection(&ptw32_mutex_test_init_lock); + LeaveCriticalSection (&ptw32_mutex_test_init_lock); } - return(result); + return (result); } |