-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsemaphore.h
52 lines (36 loc) · 1001 Bytes
/
semaphore.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef SEMAPHORE_H
#define SEMAPHORE_H
/*
Author : Benoit PAPILLAULT <[email protected]>
Creation : 17/12/2002
License : GPL
$Id: semaphore.h,v 1.5 2003/12/10 17:41:46 papillau Exp $
TODO list:
- document the use of "union" in semaphore.c
- document why we define "union" in semaphore.h
- document semaphore_init(int count)
- make a separate test program
*/
/*
semaphore_init:
create a semaphore and return the semaphore id initialized with the
specified count or -1 in case of errors
*/
int semaphore_init(int count);
/*
semaphore_incr:
increment the value of the semaphore. this function is not blocking
*/
int semaphore_incr(int sem, int val);
/*
semaphore_decr:
decrement the value of the semaphore. this function is blocking if
the current value of the semaphore is less than val
*/
int semaphore_decr(int sem, int val);
/*
semaphore_done:
destroy the semaphore (you can check with ipcs -a)
*/
int semaphore_done(int sem);
#endif