POK
/home/jaouen/pok_official/pok/trunk/libpok/include/core/lockobj.h
00001 /*
00002  *                               POK header
00003  * 
00004  * The following file is a part of the POK project. Any modification should
00005  * made according to the POK licence. You CANNOT use this file or a part of
00006  * this file is this part of a file for your own project
00007  *
00008  * For more information on the POK licence, please see our LICENCE FILE
00009  *
00010  * Please follow the coding guidelines described in doc/CODING_GUIDELINES
00011  *
00012  *                                      Copyright (c) 2007-2009 POK team 
00013  *
00014  * Created by julien on Thu Jan 15 23:34:13 2009 
00015  */
00016 
00017 
00018 #ifndef __POK_LIBPOK_LOCKOBJ_H__
00019 #define __POK_LIBPOK_LOCKOBJ_H__
00020 
00021 #include <types.h>
00022 
00023 typedef enum
00024 {
00025    POK_LOCKOBJ_KIND_MUTEX = 1,
00026    POK_LOCKOBJ_KIND_SEMAPHORE = 2,
00027    POK_LOCKOBJ_KIND_EVENT = 3
00028 }pok_lockobj_kind_t;
00029 
00030 typedef enum
00031 {
00032    POK_LOCKOBJ_POLICY_STANDARD = 0,
00033    POK_LOCKOBJ_POLICY_PIP      = 1,
00034    POK_LOCKOBJ_POLICY_PCP      = 2
00035 }pok_locking_policy_t;
00036 
00037 
00038 typedef struct
00039 {
00040    pok_lockobj_kind_t            kind;
00041    pok_locking_policy_t          locking_policy;
00042    pok_queueing_discipline_t     queueing_policy;  
00043    pok_sem_value_t               initial_value;
00044    pok_sem_value_t               max_value;
00045 }pok_lockobj_attr_t;
00046 
00047 typedef enum
00048 {
00049    LOCKOBK_LOCK_REGULAR = 1,
00050    LOCKOBJ_LOCK_TIMED   = 2
00051 }pok_lockobj_lock_kind_t;
00052 
00053 typedef enum
00054 {
00055    LOCKOBJ_OPERATION_LOCK = 1,
00056    LOCKOBJ_OPERATION_UNLOCK = 2,
00057    LOCKOBJ_OPERATION_WAIT = 3,
00058    LOCKOBJ_OPERATION_SIGNAL = 4,
00059    LOCKOBJ_OPERATION_BROADCAST = 5
00060 }pok_lockobj_operation_t;
00061 
00062 typedef struct
00063 {
00064    pok_lockobj_operation_t    operation;
00065    pok_lockobj_kind_t         obj_kind;
00066    pok_lockobj_lock_kind_t    lock_kind;
00067    uint64_t                   time;
00068 }pok_lockobj_lockattr_t;
00069 
00070 
00071 #endif