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_init.c | |
parent | 8b14911744f58cbe3730703f3fcc41cd969fd0f3 (diff) |
re-indentation, bug fixes, hooks for pre-emptive async cancelation
Diffstat (limited to 'pthread_mutex_init.c')
-rw-r--r-- | pthread_mutex_init.c | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/pthread_mutex_init.c b/pthread_mutex_init.c index eb8f206..ebf26d5 100644 --- a/pthread_mutex_init.c +++ b/pthread_mutex_init.c @@ -39,7 +39,7 @@ int -pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) +pthread_mutex_init (pthread_mutex_t * mutex, const pthread_mutexattr_t * attr) { int result = 0; pthread_mutex_t mx; @@ -50,9 +50,7 @@ pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) } if (attr != NULL - && *attr != NULL - && (*attr)->pshared == PTHREAD_PROCESS_SHARED - ) + && *attr != NULL && (*attr)->pshared == PTHREAD_PROCESS_SHARED) { /* * Creating mutex that can be shared between @@ -74,7 +72,7 @@ pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) } - mx = (pthread_mutex_t) calloc(1, sizeof(*mx)); + mx = (pthread_mutex_t) calloc (1, sizeof (*mx)); if (mx == NULL) { @@ -85,23 +83,22 @@ pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr) mx->lock_idx = PTW32_MUTEX_LOCK_IDX_INIT; mx->recursive_count = 0; mx->kind = (attr == NULL || *attr == NULL - ? PTHREAD_MUTEX_DEFAULT - : (*attr)->kind); + ? PTHREAD_MUTEX_DEFAULT : (*attr)->kind); mx->ownerThread = NULL; - if ( 0 != sem_init( &mx->wait_sema, 0, 0 )) + if (0 != sem_init (&mx->wait_sema, 0, 0)) { result = EAGAIN; - free(mx); + free (mx); mx = NULL; } else { - InitializeCriticalSection( &mx->wait_cs ); + InitializeCriticalSection (&mx->wait_cs); } } *mutex = mx; - return(result); + return (result); } |