Sistema l'errore da me commesso in fase di conversione...
[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  * This file is part of DevLib - See README.devlib for information.
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.7  2006/07/19 12:56:27  bernie
20  *#* Convert to new Doxygen style.
21  *#*
22  *#* Revision 1.6  2005/11/04 16:20:02  bernie
23  *#* Fix reference to README.devlib in header.
24  *#*
25  *#* Revision 1.5  2005/04/11 19:10:28  bernie
26  *#* Include top-level headers from cfg/ subdir.
27  *#*
28  *#* Revision 1.4  2005/01/22 04:21:20  bernie
29  *#* Add handy typedef for struct Semaphore.
30  *#*
31  *#* Revision 1.3  2004/08/25 14:12:09  rasky
32  *#* Aggiornato il comment block dei log RCS
33  *#*
34  *#* Revision 1.2  2004/06/03 11:27:09  bernie
35  *#* Add dual-license information.
36  *#*
37  *#* Revision 1.1  2004/05/23 17:27:00  bernie
38  *#* Import kern/ subdirectory.
39  *#*
40  *#*/
41
42 #ifndef KERN_SEM_H
43 #define KERN_SEM_H
44
45 #include <cfg/compiler.h>
46 #include <mware/list.h>
47
48 /* Fwd decl */
49 struct Process;
50
51
52 typedef struct Semaphore
53 {
54         struct Process *owner;
55         List            wait_queue;
56         int             nest_count;
57 } Semaphore;
58
59 /**
60  * \name Process synchronization services
61  * \{
62  */
63 void sem_init(struct Semaphore *s);
64 bool sem_attempt(struct Semaphore *s);
65 void sem_obtain(struct Semaphore *s);
66 void sem_release(struct Semaphore *s);
67 /* \} */
68
69 #endif /* KERN_SEM_H */