00001 /*header file for src/ipc/lock.cpp*/ 00002 00003 #ifndef _CORE_IPC_LOCK_HPP 00004 #define _CORE_IPC_LOCK_HPP 00005 00006 #include "src/common/error.hpp" 00007 #include "src/common/types.hpp" 00008 00009 namespace IPC { 00010 namespace Lock { 00011 00012 extern volatile bool disable_all_locks; 00013 00014 const uint32 LOCK_NAME = 0x10; 00015 00016 class lock_t 00017 { 00018 public: 00019 char name[LOCK_NAME]; 00020 // private: 00021 bool state; 00022 struct eip_ebp eipebp; 00023 uint32 eflags; 00024 public: 00025 00026 00027 lock_t(const char *nam); 00028 lock_t(); 00029 void init(const char *nam); 00030 bool locked(); //returns state 00031 void lock(); /*get the lock*/ 00032 void lock(bool slp); 00033 void lock2(); //get the lock, not spinning, sleeping 00034 void ulock(); /*release the lock*/ 00035 }; 00036 00037 00038 }; /*namespace Lock*/ 00039 }; /*namespace IPC*/ 00040 00041 extern IPC::Lock::lock_t lock_system; // when a critical section should not be interrupted 00042 00043 #endif