Add dual-license information.
[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 devlib/README 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.2  2004/06/03 11:27:09  bernie
20  * Add dual-license information.
21  *
22  * Revision 1.1  2004/05/23 17:27:00  bernie
23  * Import kern/ subdirectory.
24  *
25  */
26
27 #ifndef KERN_SEM_H
28 #define KERN_SEM_H
29
30 #include "compiler.h"
31 #include <mware/list.h>
32
33 /* Fwd decl */
34 struct Process;
35
36
37 struct Semaphore
38 {
39         struct Process *owner;
40         List            wait_queue;
41         int             nest_count;
42 };
43
44 /*!
45  * \name Process synchronization services
46  * \{
47  */
48 void sem_init(struct Semaphore *s);
49 bool sem_attempt(struct Semaphore *s);
50 void sem_obtain(struct Semaphore *s);
51 void sem_release(struct Semaphore *s);
52 /* \} */
53
54 #endif /* KERN_SEM_H */