summaryrefslogtreecommitdiff
path: root/pthread_mutex_unlock.c
diff options
context:
space:
mode:
authorrpj <rpj>2004-05-17 01:38:02 +0000
committerrpj <rpj>2004-05-17 01:38:02 +0000
commit771465fed0cf50ee2dd790723245fc091699c324 (patch)
treed8c18d095a33fe7c4564bd90c5f313bb9e4057dd /pthread_mutex_unlock.c
parent8b14911744f58cbe3730703f3fcc41cd969fd0f3 (diff)
re-indentation, bug fixes, hooks for pre-emptive async cancelation
Diffstat (limited to 'pthread_mutex_unlock.c')
-rw-r--r--pthread_mutex_unlock.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/pthread_mutex_unlock.c b/pthread_mutex_unlock.c
index c25f3a5..aff3637 100644
--- a/pthread_mutex_unlock.c
+++ b/pthread_mutex_unlock.c
@@ -39,7 +39,7 @@
int
-pthread_mutex_unlock(pthread_mutex_t *mutex)
+pthread_mutex_unlock (pthread_mutex_t * mutex)
{
int result = 0;
pthread_mutex_t mx;
@@ -59,24 +59,24 @@ pthread_mutex_unlock(pthread_mutex_t *mutex)
if (mx != PTHREAD_MUTEX_INITIALIZER)
{
if (mx->ownerThread == (pthread_t) PTW32_MUTEX_OWNER_ANONYMOUS
- || pthread_equal(mx->ownerThread, pthread_self()))
+ || pthread_equal (mx->ownerThread, pthread_self ()))
{
- if( mx->kind != PTHREAD_MUTEX_RECURSIVE_NP
- || 0 == --mx->recursive_count )
+ if (mx->kind != PTHREAD_MUTEX_RECURSIVE_NP
+ || 0 == --mx->recursive_count)
{
mx->ownerThread = NULL;
- EnterCriticalSection( &mx->wait_cs );
+ EnterCriticalSection (&mx->wait_cs);
- if( InterlockedDecrement( &mx->lock_idx ) >= 0 )
+ if (InterlockedDecrement (&mx->lock_idx) >= 0)
{
/* Someone is waiting on that mutex */
- if (sem_post( &mx->wait_sema ) != 0)
+ if (sem_post (&mx->wait_sema) != 0)
{
result = errno;
}
}
- LeaveCriticalSection( &mx->wait_cs );
+ LeaveCriticalSection (&mx->wait_cs);
}
}
else
@@ -89,5 +89,5 @@ pthread_mutex_unlock(pthread_mutex_t *mutex)
result = EINVAL;
}
- return(result);
+ return (result);
}