00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- 00002 00003 // -- BEGIN LICENSE BLOCK ---------------------------------------------- 00004 // This file is part of FZIs ic_workspace. 00005 // 00006 // This program is free software licensed under the LGPL 00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3). 00008 // You can find a copy of this license in LICENSE folder in the top 00009 // directory of the source code. 00010 // 00011 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany 00012 // 00013 // -- END LICENSE BLOCK ------------------------------------------------ 00014 00015 //---------------------------------------------------------------------- 00024 //---------------------------------------------------------------------- 00025 #include "icl_core_thread/MutexImplLxrt38.h" 00026 00027 #include <icl_core/internal_raw_debug.h> 00028 #include <icl_core/os_lxrt.h> 00029 00030 #include "icl_core_thread/Common.h" 00031 00032 #define STRICT_LXRT_CHECKS 00033 00034 00035 namespace icl_core { 00036 namespace thread { 00037 00038 MutexImplLxrt38::MutexImplLxrt38() 00039 : m_sem(1, BIN_SEM) 00040 { 00041 } 00042 00043 MutexImplLxrt38::~MutexImplLxrt38() 00044 { 00045 } 00046 00047 bool MutexImplLxrt38::lock() 00048 { 00049 return m_sem.wait(); 00050 } 00051 00052 bool MutexImplLxrt38::lock(const icl_core::TimeSpan& timeout) 00053 { 00054 return m_sem.wait(timeout); 00055 } 00056 00057 bool MutexImplLxrt38::lock(const icl_core::TimeStamp& timeout) 00058 { 00059 return m_sem.wait(timeout); 00060 } 00061 00062 bool MutexImplLxrt38::tryLock() 00063 { 00064 return m_sem.tryWait(); 00065 } 00066 00067 void MutexImplLxrt38::unlock() 00068 { 00069 m_sem.post(); 00070 } 00071 00072 } 00073 }