summaryrefslogtreecommitdiff
path: root/pthread_spin_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_spin_unlock.c
parent8b14911744f58cbe3730703f3fcc41cd969fd0f3 (diff)
re-indentation, bug fixes, hooks for pre-emptive async cancelation
Diffstat (limited to 'pthread_spin_unlock.c')
-rw-r--r--pthread_spin_unlock.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/pthread_spin_unlock.c b/pthread_spin_unlock.c
index 42fb4a6..7b40f7f 100644
--- a/pthread_spin_unlock.c
+++ b/pthread_spin_unlock.c
@@ -39,13 +39,13 @@
int
-pthread_spin_unlock(pthread_spinlock_t *lock)
+pthread_spin_unlock (pthread_spinlock_t * lock)
{
register pthread_spinlock_t s;
if (NULL == lock || NULL == *lock)
{
- return(EINVAL);
+ return (EINVAL);
}
s = *lock;
@@ -55,13 +55,20 @@ pthread_spin_unlock(pthread_spinlock_t *lock)
return EPERM;
}
- switch ((long) ptw32_interlocked_compare_exchange((PTW32_INTERLOCKED_LPLONG) &(s->interlock),
- (PTW32_INTERLOCKED_LONG) PTW32_SPIN_UNLOCKED,
- (PTW32_INTERLOCKED_LONG) PTW32_SPIN_LOCKED ))
+ switch ((long)
+ ptw32_interlocked_compare_exchange ((PTW32_INTERLOCKED_LPLONG) &
+ (s->interlock),
+ (PTW32_INTERLOCKED_LONG)
+ PTW32_SPIN_UNLOCKED,
+ (PTW32_INTERLOCKED_LONG)
+ PTW32_SPIN_LOCKED))
{
- case PTW32_SPIN_LOCKED: return 0;
- case PTW32_SPIN_UNLOCKED: return EPERM;
- case PTW32_SPIN_USE_MUTEX: return pthread_mutex_unlock(&(s->u.mutex));
+ case PTW32_SPIN_LOCKED:
+ return 0;
+ case PTW32_SPIN_UNLOCKED:
+ return EPERM;
+ case PTW32_SPIN_USE_MUTEX:
+ return pthread_mutex_unlock (&(s->u.mutex));
}
return EINVAL;