91b56157c04d952dc9e2e5e8d4ee4cd36c300f23
[bertos.git] / kern / sem.h
1 /**
2  * \file
3  * <!--
4  * Copyright 2001,2004 Develer S.r.l. (http://www.develer.com/)
5  * Copyright 1999,2000,2001 Bernardo Innocenti <bernie@develer.com>
6  * All Rights Reserved.
7  * -->
8  *
9  * \brief Mutually exclusive semaphores.
10  *        Shared locking not supported in this implementation.
11  *
12  * \version $Id$
13  *
14  * \author Bernardo Innocenti <bernie@develer.com>
15  */
16
17 /*
18  * $Log$
19  * Revision 1.1  2004/05/23 17:27:00  bernie
20  * Import kern/ subdirectory.
21  *
22  */
23
24 #ifndef KERN_SEM_H
25 #define KERN_SEM_H
26
27 #include "compiler.h"
28 #include <mware/list.h>
29
30 /* Fwd decl */
31 struct Process;
32
33
34 struct Semaphore
35 {
36         struct Process *owner;
37         List            wait_queue;
38         int             nest_count;
39 };
40
41 /*!
42  * \name Process synchronization services
43  * \{
44  */
45 void sem_init(struct Semaphore *s);
46 bool sem_attempt(struct Semaphore *s);
47 void sem_obtain(struct Semaphore *s);
48 void sem_release(struct Semaphore *s);
49 /* \} */
50
51 #endif /* KERN_SEM_H */