Reimplement unnamed POSIX semaphores using user_mutex

* Fixes sharing semantics, so non-shared semaphores in non-shared
  memory do not become shared after a fork.
* Adds two new system calls: _user_mutex_sem_acquire/release(),
  which reuse the user_mutex address-hashed wait mechanism.
* Named semaphores continue to use traditional sem_id semaphores.
This commit is contained in:
Hamish Morrison
2015-05-24 14:03:40 +01:00
parent 03796a0cef
commit d6d439f3f7
6 changed files with 286 additions and 291 deletions
+7 -3
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2008-2012 Haiku, Inc.
* Copyright 2008-2015 Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _SEMAPHORE_H_
@@ -13,8 +13,12 @@
typedef struct _sem_t {
int32_t id;
int32_t _padding[3];
int32_t type;
union {
int32_t named_sem_id;
int32_t unnamed_sem;
} u;
int32_t padding[2];
} sem_t;
#define SEM_FAILED ((sem_t*)(long)-1)