00001 // -*- c++ -*- 00002 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 00003 00004 // O S C L _ S E M A P H O R E 00005 00006 // = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 00007 00014 // Definition file for OSCL Semaphore 00015 #ifndef OSCL_SEMAPHORE_H_INCLUDED 00016 #define OSCL_SEMAPHORE_H_INCLUDED 00017 00018 #ifndef OSCLCONFIG_PROC_H_INCLUDED 00019 #include "osclconfig_proc.h" 00020 #endif 00021 00022 #ifndef OSCL_THREAD_H_INCLUDED 00023 #include "oscl_thread.h" 00024 #endif 00025 00026 00030 class OsclSemaphore 00031 { 00032 public: 00033 00037 OSCL_IMPORT_REF OsclSemaphore(); 00038 00042 OSCL_IMPORT_REF ~OsclSemaphore(); 00043 00052 OSCL_IMPORT_REF OsclProcStatus::eOsclProcError Create(uint32 initVal = 0); 00053 00062 OSCL_IMPORT_REF OsclProcStatus::eOsclProcError Close(); 00063 00072 OSCL_IMPORT_REF OsclProcStatus::eOsclProcError Wait(); 00073 00085 OSCL_IMPORT_REF OsclProcStatus::eOsclProcError Wait(uint32 timeout_msec); 00086 00099 OSCL_IMPORT_REF OsclProcStatus::eOsclProcError TryWait(); 00100 00109 OSCL_IMPORT_REF OsclProcStatus::eOsclProcError Signal(); 00110 00111 private: 00112 00113 00114 00115 bool bCreated; 00116 //for pthreads implementations without sem timedwait support. 00117 TOsclMutexObject ObjMutex; 00118 TOsclConditionObject ObjCondition; 00119 uint32 iCount; 00120 00121 00122 }; 00123 00124 00125 00126 00127 00128 #endif // END OF File 00129