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