µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
thread
Go to the documentation of this file.
1/*
2 * This file is part of the µOS++ distribution.
3 * (https://github.com/micro-os-plus)
4 * Copyright (c) 2016-2023 Liviu Ionescu. All rights reserved.
5 *
6 * Permission to use, copy, modify, and/or distribute this software
7 * for any purpose is hereby granted, under the terms of the MIT license.
8 *
9 * If a copy of the license was not distributed with this file, it can
10 * be obtained from https://opensource.org/licenses/mit/.
11 */
12
13/*
14 * The code is inspired by LLVM libcxx and GNU libstdc++-v3.
15 */
16
17#ifndef CMSIS_PLUS_ESTD_THREAD_
18#define CMSIS_PLUS_ESTD_THREAD_
19
20// ----------------------------------------------------------------------------
21
22// Include the next <thread> file found in the search path.
23#pragma GCC diagnostic push
24#if defined(__clang__)
25#pragma clang diagnostic ignored "-Wgnu-include-next"
26#endif
27#include_next <thread>
28#pragma GCC diagnostic pop
29
30#include <type_traits>
31#include <functional>
32
33#include <cmsis-plus/rtos/os.h>
34
36
37// ----------------------------------------------------------------------------
38
39namespace os
40{
41 namespace estd
42 {
43 // ------------------------------------------------------------------------
44
50#include "thread_internal.h"
51
56 // ==========================================================================
57 } /* namespace estd */
58} /* namespace os */
59
60namespace std
61{
62#pragma GCC diagnostic push
63#if defined(__clang__)
64#pragma clang diagnostic ignored "-Wdeprecated-declarations"
65#elif defined(__GNUC__)
66#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
67#endif
68
69 // Define a std::hash specialisation.
70 template<>
71 struct hash<os::estd::thread::id> : public std::unary_function<
72 os::estd::thread::id, size_t>
73 {
74 inline size_t
75 operator() (os::estd::thread::id v) const
76 {
77 return std::hash<os::estd::thread::native_handle_type> () (
78 v.native_thread_);
79 }
80 };
81
82#pragma GCC diagnostic pop
83
84}
85
86#if defined(OS_HAS_STD_THREADS) && defined(OS_INCLUDE_STD_THREADS)
87
88namespace std
89{
95#include "thread_internal.h"
96
97 // Define a std::hash specialisation.
98 template<>
99 struct hash<std::thread::id> : public std::unary_function<std::thread::id,
100 size_t>
101 {
102 inline size_t
103 operator() (std::thread::id v) const
104 {
105 return std::hash<std::thread::native_handle_type> () (v.native_thread_);
106 }
107 };
108
112}
113
114#endif
115
116// ----------------------------------------------------------------------------
117
118#endif /* CMSIS_PLUS_ESTD_THREAD_ */
Thread unique id.
System namespace.
Standard std namespace.
Single file µOS++ RTOS definitions.