summaryrefslogtreecommitdiff
path: root/sysdeps/mach/hurd/pt-mutex-transfer-np.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach/hurd/pt-mutex-transfer-np.c')
-rw-r--r--sysdeps/mach/hurd/pt-mutex-transfer-np.c49
1 files changed, 25 insertions, 24 deletions
diff --git a/sysdeps/mach/hurd/pt-mutex-transfer-np.c b/sysdeps/mach/hurd/pt-mutex-transfer-np.c
index dc70909..618ab5b 100644
--- a/sysdeps/mach/hurd/pt-mutex-transfer-np.c
+++ b/sysdeps/mach/hurd/pt-mutex-transfer-np.c
@@ -23,7 +23,8 @@
#include "pt-mutex.h"
#include <hurdlock.h>
-int __pthread_mutex_transfer_np (pthread_mutex_t *mtxp, pthread_t th)
+int
+__pthread_mutex_transfer_np (pthread_mutex_t *mtxp, pthread_t th)
{
struct __pthread *self = _pthread_self ();
struct __pthread *pt = __pthread_getid (th);
@@ -38,34 +39,34 @@ int __pthread_mutex_transfer_np (pthread_mutex_t *mtxp, pthread_t th)
switch (MTX_TYPE (mtxp))
{
- case PT_MTX_NORMAL:
- break;
+ case PT_MTX_NORMAL:
+ break;
- case PT_MTX_RECURSIVE:
- case PT_MTX_ERRORCHECK:
- if (!mtx_owned_p (mtxp, self, flags))
- ret = EPERM;
- else
- mtx_set_owner (mtxp, pt, flags);
+ case PT_MTX_RECURSIVE:
+ case PT_MTX_ERRORCHECK:
+ if (!mtx_owned_p (mtxp, self, flags))
+ ret = EPERM;
+ else
+ mtx_set_owner (mtxp, pt, flags);
- break;
+ break;
- case PT_MTX_NORMAL | PTHREAD_MUTEX_ROBUST:
- case PT_MTX_RECURSIVE | PTHREAD_MUTEX_ROBUST:
- case PT_MTX_ERRORCHECK | PTHREAD_MUTEX_ROBUST:
- /* Note that this can be used to transfer an inconsistent
- * mutex as well. The new owner will still have the same
- * flags as the original. */
- if (mtxp->__owner_id != self->thread ||
- (int)(mtxp->__lock & LLL_OWNER_MASK) != __getpid ())
- ret = EPERM;
- else
- mtxp->__owner_id = pt->thread;
+ case PT_MTX_NORMAL | PTHREAD_MUTEX_ROBUST:
+ case PT_MTX_RECURSIVE | PTHREAD_MUTEX_ROBUST:
+ case PT_MTX_ERRORCHECK | PTHREAD_MUTEX_ROBUST:
+ /* Note that this can be used to transfer an inconsistent
+ * mutex as well. The new owner will still have the same
+ * flags as the original. */
+ if (mtxp->__owner_id != self->thread ||
+ (int) (mtxp->__lock & LLL_OWNER_MASK) != __getpid ())
+ ret = EPERM;
+ else
+ mtxp->__owner_id = pt->thread;
- break;
+ break;
- default:
- ret = EINVAL;
+ default:
+ ret = EINVAL;
}
return (ret);