POK
lockobj.h
1 /*
2  * POK header
3  *
4  * The following file is a part of the POK project. Any modification should
5  * made according to the POK licence. You CANNOT use this file or a part of
6  * this file is this part of a file for your own project
7  *
8  * For more information on the POK licence, please see our LICENCE FILE
9  *
10  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
11  *
12  * Copyright (c) 2007-2009 POK team
13  *
14  * Created by julien on Thu Jan 15 23:34:13 2009
15  */
16 
17 
18 #ifndef __POK_LIBPOK_LOCKOBJ_H__
19 #define __POK_LIBPOK_LOCKOBJ_H__
20 
21 #include <types.h>
22 
23 typedef enum
24 {
25  POK_LOCKOBJ_KIND_MUTEX = 1,
26  POK_LOCKOBJ_KIND_SEMAPHORE = 2,
27  POK_LOCKOBJ_KIND_EVENT = 3
28 }pok_lockobj_kind_t;
29 
30 typedef enum
31 {
32  POK_LOCKOBJ_POLICY_STANDARD = 0,
33  POK_LOCKOBJ_POLICY_PIP = 1,
34  POK_LOCKOBJ_POLICY_PCP = 2
35 }pok_locking_policy_t;
36 
37 
38 typedef struct
39 {
40  pok_lockobj_kind_t kind;
41  pok_locking_policy_t locking_policy;
42  pok_queueing_discipline_t queueing_policy;
43  pok_sem_value_t initial_value;
44  pok_sem_value_t max_value;
46 
47 typedef enum
48 {
49  LOCKOBK_LOCK_REGULAR = 1,
50  LOCKOBJ_LOCK_TIMED = 2
51 }pok_lockobj_lock_kind_t;
52 
53 typedef enum
54 {
55  LOCKOBJ_OPERATION_LOCK = 1,
56  LOCKOBJ_OPERATION_UNLOCK = 2,
57  LOCKOBJ_OPERATION_WAIT = 3,
58  LOCKOBJ_OPERATION_SIGNAL = 4,
59  LOCKOBJ_OPERATION_BROADCAST = 5
60 }pok_lockobj_operation_t;
61 
62 typedef struct
63 {
64  pok_lockobj_operation_t operation;
65  pok_lockobj_kind_t obj_kind;
66  pok_lockobj_lock_kind_t lock_kind;
67  uint64_t time;
69 
70 
71 #endif