summaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/pt-mutex-lock.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd/pt-mutex-lock.c')
-rw-r--r--sysdeps/mach/hurd/pt-mutex-lock.c67
1 files changed, 34 insertions, 33 deletions
diff --git a/sysdeps/mach/hurd/pt-mutex-lock.c b/sysdeps/mach/hurd/pt-mutex-lock.c
index 642129f..8ebb4f6 100644
--- a/sysdeps/mach/hurd/pt-mutex-lock.c
+++ b/sysdeps/mach/hurd/pt-mutex-lock.c
@@ -23,7 +23,8 @@
#include "pt-mutex.h"
#include <hurdlock.h>
-int __pthread_mutex_lock (pthread_mutex_t *mtxp)
+int
+__pthread_mutex_lock (pthread_mutex_t *mtxp)
{
struct __pthread *self;
int flags = mtxp->__flags & GSYNC_SHARED;
@@ -31,45 +32,45 @@ int __pthread_mutex_lock (pthread_mutex_t *mtxp)
switch (MTX_TYPE (mtxp))
{
- case PT_MTX_NORMAL:
- lll_lock (&mtxp->__lock, flags);
- break;
+ case PT_MTX_NORMAL:
+ lll_lock (&mtxp->__lock, flags);
+ break;
- case PT_MTX_RECURSIVE:
- self = _pthread_self ();
- if (mtx_owned_p (mtxp, self, flags))
- {
- if (__glibc_unlikely (mtxp->__cnt + 1 == 0))
- return (EAGAIN);
+ case PT_MTX_RECURSIVE:
+ self = _pthread_self ();
+ if (mtx_owned_p (mtxp, self, flags))
+ {
+ if (__glibc_unlikely (mtxp->__cnt + 1 == 0))
+ return (EAGAIN);
- ++mtxp->__cnt;
- return (ret);
- }
+ ++mtxp->__cnt;
+ return (ret);
+ }
- lll_lock (&mtxp->__lock, flags);
- mtx_set_owner (mtxp, self, flags);
- mtxp->__cnt = 1;
- break;
+ lll_lock (&mtxp->__lock, flags);
+ mtx_set_owner (mtxp, self, flags);
+ mtxp->__cnt = 1;
+ break;
- case PT_MTX_ERRORCHECK:
- self = _pthread_self ();
- if (mtx_owned_p (mtxp, self, flags))
- return (EDEADLK);
+ case PT_MTX_ERRORCHECK:
+ self = _pthread_self ();
+ if (mtx_owned_p (mtxp, self, flags))
+ return (EDEADLK);
- lll_lock (&mtxp->__lock, flags);
- mtx_set_owner (mtxp, self, flags);
- break;
+ lll_lock (&mtxp->__lock, flags);
+ mtx_set_owner (mtxp, self, flags);
+ break;
- case PT_MTX_NORMAL | PTHREAD_MUTEX_ROBUST:
- case PT_MTX_RECURSIVE | PTHREAD_MUTEX_ROBUST:
- case PT_MTX_ERRORCHECK | PTHREAD_MUTEX_ROBUST:
- self = _pthread_self ();
- ROBUST_LOCK (self, mtxp, __lll_robust_lock, flags);
- break;
+ case PT_MTX_NORMAL | PTHREAD_MUTEX_ROBUST:
+ case PT_MTX_RECURSIVE | PTHREAD_MUTEX_ROBUST:
+ case PT_MTX_ERRORCHECK | PTHREAD_MUTEX_ROBUST:
+ self = _pthread_self ();
+ ROBUST_LOCK (self, mtxp, __lll_robust_lock, flags);
+ break;
- default:
- ret = EINVAL;
- break;
+ default:
+ ret = EINVAL;
+ break;
}
return (ret);