Added and implemented new system calls switch_sem() and switch_sem_etc(); even if

they are public now, they might become private later on.
It's almost the same as acquire_sem() but allows you to release another semaphore
atomically. This makes condvar implementations and the like very simple to do.
Added B_CHECK_PERMISSION flags to the user calls, although it's not honored yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11887 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-03-17 22:35:00 +00:00
parent 63531836b9
commit 34e92cad76
5 changed files with 70 additions and 8 deletions
+3 -2
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2004, Axel Dörfler, [email protected].
* Copyright 2002-2005, Axel Dörfler, [email protected].
* Distributed under the terms of the MIT License.
*
* Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
@@ -12,7 +12,6 @@
#include <OS.h>
#include <thread.h>
struct kernel_args;
@@ -33,6 +32,8 @@ sem_id _user_create_sem(int32 count, const char *name);
status_t _user_delete_sem(sem_id id);
status_t _user_acquire_sem(sem_id id);
status_t _user_acquire_sem_etc(sem_id id, int32 count, uint32 flags, bigtime_t timeout);
status_t _user_switch_sem(sem_id releaseSem, sem_id id);
status_t _user_switch_sem_etc(sem_id releaseSem, sem_id id, int32 count, uint32 flags, bigtime_t timeout);
status_t _user_release_sem(sem_id id);
status_t _user_release_sem_etc(sem_id id, int32 count, uint32 flags);
status_t _user_get_sem_count(sem_id id, int32* thread_count);
+3
View File
@@ -46,6 +46,9 @@ extern status_t _kern_get_safemode_option(const char *parameter, char *buffer,
/* sem functions */
extern sem_id _kern_create_sem(int count, const char *name);
extern status_t _kern_delete_sem(sem_id id);
extern status_t _kern_switch_sem(sem_id releaseSem, sem_id id);
extern status_t _kern_switch_sem_etc(sem_id releaseSem, sem_id id, uint32 count,
uint32 flags, bigtime_t timeout);
extern status_t _kern_acquire_sem(sem_id id);
extern status_t _kern_acquire_sem_etc(sem_id id, uint32 count, uint32 flags, bigtime_t timeout);
extern status_t _kern_release_sem(sem_id id);