16#ifndef CMSIS_PLUS_ESTD_MUTEX_
17#define CMSIS_PLUS_ESTD_MUTEX_
22#pragma GCC diagnostic push
24#pragma clang diagnostic ignored "-Wgnu-include-next"
27#pragma GCC diagnostic pop
39#pragma GCC diagnostic push
41#pragma clang diagnostic ignored "-Wc++98-compat"
141 template <
typename Rep_T,
typename Period_T>
143 try_lock_for (
const std::chrono::duration<Rep_T, Period_T>& rel_time);
145 template <
typename Clock_T,
typename Duration_T>
148 const std::chrono::time_point<Clock_T, Duration_T>& abs_time);
165 template <
typename Rep_T,
typename Period_T>
167 try_lock_for (
const std::chrono::duration<Rep_T, Period_T>& rel_time);
169 template <
typename Clock_T,
typename Duration_T>
172 const std::chrono::time_point<Clock_T, Duration_T>& abs_time);
195 :
nm_{
os::rtos::
mutex::initializer_recursive }
207#pragma GCC diagnostic push
208#if defined(__clang__)
209#elif defined(__GNUC__)
210#pragma GCC diagnostic ignored "-Waggregate-return"
213 template <
typename Rep_T,
typename Period_T>
216 const std::chrono::duration<Rep_T, Period_T>& rel_time)
218 using namespace std::chrono;
220 if (rel_time > duration<Rep_T, Period_T>::zero ())
223 os::estd::chrono::ceil<os::estd::chrono::systicks> (rel_time)
233 else if (res == ETIMEDOUT)
239 "timed_mutex try_lock failed");
243 template <
typename Clock_T,
typename Duration_T>
246 const std::chrono::time_point<Clock_T, Duration_T>& abs_time)
248 using clock = Clock_T;
250 auto now = clock::now ();
251 while (now < abs_time)
263#pragma GCC diagnostic pop
267 template <
typename Rep_T,
typename Period_T>
270 const std::chrono::duration<Rep_T, Period_T>& rel_time)
272 using namespace std::chrono;
274 if (rel_time > duration<Rep_T, Period_T>::zero ())
277 os::estd::chrono::ceil<os::estd::chrono::systicks> (rel_time)
287 else if (res == ETIMEDOUT)
293 "timed_mutex try_lock failed");
297 template <
typename Clock_T,
typename Duration_T>
300 const std::chrono::time_point<Clock_T, Duration_T>& abs_time)
302 using clock = Clock_T;
304 auto now = clock::now ();
305 while (now < abs_time)
321#pragma GCC diagnostic pop
323#if defined(OS_HAS_STD_THREADS)
mutex & operator=(const mutex &)=delete
native_handle_type native_handle()
recursive_mutex(const recursive_mutex &)=delete
~recursive_mutex()=default
native_handle_type native_handle()
recursive_timed_mutex(const recursive_timed_mutex &)=delete
bool try_lock_for(const std::chrono::duration< Rep_T, Period_T > &rel_time)
bool try_lock_until(const std::chrono::time_point< Clock_T, Duration_T > &abs_time)
~recursive_timed_mutex()=default
recursive_timed_mutex()=default
bool try_lock_for(const std::chrono::duration< Rep_T, Period_T > &rel_time)
bool try_lock_until(const std::chrono::time_point< Clock_T, Duration_T > &abs_time)
timed_mutex(const timed_mutex &)=delete
result_t timed_lock(clock::duration_t timeout)
Timed attempt to lock/acquire the mutex.
port::clock::duration_t duration_t
Type of variables holding clock durations.
void __throw_system_error(int ev, const char *what_arg)
@ ok
Function completed; no errors or events occurred.
uint32_t result_t
Type of values returned by RTOS functions.
Single file µOS++ RTOS definitions.