mn_criticalsection.hpp
Go to the documentation of this file.
1 /*
2 *This file is part of the Mini Thread Library (https://github.com/RoseLeBlood/MiniThread ).
3 *Copyright (c) 2020 Amber-Sophia Schroeck
4 *
5 *The Mini Thread Library is free software; you can redistribute it and/or modify
6 *it under the terms of the GNU Lesser General Public License as published by
7 *the Free Software Foundation, version 3, or (at your option) any later version.
8 
9 *The Mini Thread Library is distributed in the hope that it will be useful, but
10 *WITHOUT ANY WARRANTY; without even the implied warranty of
11 *MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 *General Public License for more details.
13 *
14 *You should have received a copy of the GNU Lesser General Public
15 *License along with the Mini Thread Library; if not, see
16 *<https://www.gnu.org/licenses/>.
17 */
18 #ifndef _MINLIB_CITCALLOCK_NEW_H_
19 #define _MINLIB_CITCALLOCK_NEW_H_
20 
21 #include "mn_system_lock.hpp"
22 
23 
24 namespace mn {
25  namespace system {
33  public:
35  basic_critical_section(portMUX_TYPE type);
36 
43  virtual int lock(unsigned int timeout = 0);
48  virtual int unlock();
49  protected:
50  portMUX_TYPE m_pHandle;
51  };
60  public:
73  virtual int lock(unsigned int timeout = UINT_MAX);
74 
81  virtual int time_lock(const struct timespec *timeout);
86  virtual int unlock();
91  virtual bool try_lock();
92  protected:
93  portMUX_TYPE m_pHandle;
94  };
95 
100  public:
108  virtual int lock(unsigned int timeout = UINT_MAX);
113  virtual int unlock();
114  protected:
115  unsigned int m_iState;
116  };
117  }
118 }
119 
120 #endif
Definition: mn_system_lock.hpp:37
Definition: mn_criticalsection.hpp:99
virtual int lock(unsigned int timeout=UINT_MAX)
Definition: mn_criticalsection.cpp:120
virtual int unlock()
Definition: mn_criticalsection.cpp:127
unsigned int m_iState
Definition: mn_criticalsection.hpp:115
Definition: mn_criticalsection.hpp:59
portMUX_TYPE m_pHandle
Definition: mn_criticalsection.hpp:93
virtual int lock(unsigned int timeout=UINT_MAX)
Definition: mn_criticalsection.cpp:74
virtual int time_lock(const struct timespec *timeout)
Definition: mn_criticalsection.cpp:89
virtual bool try_lock()
Definition: mn_criticalsection.cpp:101
basic_critical_section_timedout()
Definition: mn_criticalsection.cpp:68
virtual int unlock()
Definition: mn_criticalsection.cpp:110
Definition: mn_criticalsection.hpp:32
virtual int lock(unsigned int timeout=0)
Definition: mn_criticalsection.cpp:50
portMUX_TYPE m_pHandle
Definition: mn_criticalsection.hpp:50
virtual int unlock()
Definition: mn_criticalsection.cpp:60
basic_critical_section()
Definition: mn_criticalsection.cpp:38
struct mn::memory::detail::ptr_difference type
Definition: mn_allocator_typetraits.hpp:25