xref: /haiku/headers/private/kernel/sem.h (revision 95bac3fda53a4cb21880712d7b43f8c21db32a2e)
1 /*
2  * Copyright 2002-2004, Axel Dörfler, axeld@pinc-software.de.
3  * Distributed under the terms of the MIT License.
4  *
5  * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved.
6  * Distributed under the terms of the NewOS License.
7  */
8 #ifndef KERNEL_SEM_H
9 #define KERNEL_SEM_H
10 
11 
12 #include <OS.h>
13 #include <thread.h>
14 
15 
16 struct kernel_args;
17 
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
23 extern status_t sem_init(struct kernel_args *args);
24 extern int sem_delete_owned_sems(team_id owner);
25 extern status_t	sem_interrupt_thread(struct thread *t);
26 extern int32 sem_used_sems(void);
27 extern int32 sem_max_sems(void);
28 
29 extern sem_id create_sem_etc(int32 count, const char *name, team_id owner);
30 
31 /* user calls */
32 sem_id _user_create_sem(int32 count, const char *name);
33 status_t _user_delete_sem(sem_id id);
34 status_t _user_acquire_sem(sem_id id);
35 status_t _user_acquire_sem_etc(sem_id id, int32 count, uint32 flags, bigtime_t timeout);
36 status_t _user_release_sem(sem_id id);
37 status_t _user_release_sem_etc(sem_id id, int32 count, uint32 flags);
38 status_t _user_get_sem_count(sem_id id, int32* thread_count);
39 status_t _user_get_sem_info(sem_id, struct sem_info *, size_t);
40 status_t _user_get_next_sem_info(team_id, int32 *, struct sem_info *, size_t);
41 status_t _user_set_sem_owner(sem_id id, team_id team);
42 
43 #ifdef __cplusplus
44 }
45 #endif
46 
47 #endif	/* KERNEL_SEM_H */
48