00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*- 00002 00003 #ifndef switch_lock_i_h 00004 #define switch_lock_i_h 00005 00006 #include <cassert> 00007 #include "cpu_lock.h" 00008 #include "lock_guard.h" 00009 #include "context.h" 00010 00011 // 00012 // IMPLEMENTATION of inline functions follows 00013 // 00014 00015 00016 00023 inline bool 00024 Switch_lock::try_lock() 00025 { 00026 Lock_guard<Cpu_lock> guard (&cpu_lock); 00027 00028 bool ret = cas (&_lock_owner, static_cast<Context*>(0), current()); 00029 00030 if (ret) 00031 current()->inc_lock_cnt(); // Do not lose this lock if current is deleted 00032 00033 return ret; 00034 } 00035 00036 #endif // switch_lock_i_h