ISIX-RTOS - small operating system for ARM microcontrollers 1.2

semaphore.h

Go to the documentation of this file.
00001 #ifndef PRV_ISIX_SEMAPHORE_H_
00002 #define PRV_ISIX_SEMAPHORE_H_
00003 
00004 
00005 #include <prv/list.h>
00006 
00007 /*--------------------------------------------------------------*/
00008 enum ihandle_type
00009 {
00010         IHANDLE_T_SEM=1,
00011         IHANDLE_T_FIFO=2
00012 };
00013 
00014 /*--------------------------------------------------------------*/
00015 
00016 //Structure of semaphore
00017 struct sem_struct
00018 {
00019     enum ihandle_type type;
00020         //Semaphore val
00021     int value;
00022     //Task val waiting for semaphore
00023     list_entry_t sem_task;
00024     //Resource type
00025     bool static_mem;
00026     //Semaphore limit value
00027     int limit_value;
00028 };
00029 
00030 /*--------------------------------------------------------------*/
00031 
00032 //Semaphore can by destroyed
00033 static inline bool isixp_sem_can_destroy(sem_t *sem)
00034 {
00035    return list_isempty(&sem->sem_task);
00036 }
00037 
00038 /*--------------------------------------------------------------*/
00039 
00040 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines