summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorguo <[email protected]>2021-10-14 07:57:24 +0800
committerGitHub <[email protected]>2021-10-14 07:57:24 +0800
commitba5c62313917474ff7ecb49df1cd0c4d13ebda71 (patch)
treea497f07ca09acbb6053d7e0955b485f8223fc83a /components
parent0711a54d3dc8d4b5a483bc1afcada727ef5ea4a4 (diff)
parentbf8afd09f38f8744c45f65a7e3ccb49ec5e85b01 (diff)
Merge pull request #5164 from Guozhanxin/cpp11_armclang
Diffstat (limited to 'components')
-rw-r--r--components/cplusplus/Kconfig2
-rw-r--r--components/cplusplus/cpp11/armclang/thread.cpp14
2 files changed, 14 insertions, 2 deletions
diff --git a/components/cplusplus/Kconfig b/components/cplusplus/Kconfig
index dfd6786004..dfab433da0 100644
--- a/components/cplusplus/Kconfig
+++ b/components/cplusplus/Kconfig
@@ -7,7 +7,7 @@ config RT_USING_CPLUSPLUS
if RT_USING_CPLUSPLUS
config RT_USING_CPLUSPLUS11
- bool "Enable c++11 feature support"
+ bool "Enable c++11 threading feature support"
default n
select RT_USING_LIBC
select RT_USING_DFS
diff --git a/components/cplusplus/cpp11/armclang/thread.cpp b/components/cplusplus/cpp11/armclang/thread.cpp
index f7f0cb4077..46306eceb8 100644
--- a/components/cplusplus/cpp11/armclang/thread.cpp
+++ b/components/cplusplus/cpp11/armclang/thread.cpp
@@ -73,7 +73,19 @@ extern "C" void __ARM_TPL_thread_yield()
extern "C" int __ARM_TPL_thread_nanosleep(const __ARM_TPL_timespec_t *__req,
__ARM_TPL_timespec_t *__rem)
{
- return nanosleep(__req, rem);
+ rt_tick_t tick;
+
+ tick = __req->tv_sec * RT_TICK_PER_SECOND + (__req->tv_nsec * RT_TICK_PER_SECOND)/ 1000000000;
+ rt_thread_delay(tick);
+
+ if (__rem)
+ {
+ tick = rt_tick_get() - tick;
+ /* get the passed time */
+ __rem->tv_sec = tick/RT_TICK_PER_SECOND;
+ __rem->tv_nsec = (tick%RT_TICK_PER_SECOND) * (1000000000/RT_TICK_PER_SECOND);
+ }
+ return 0;
}
extern "C" unsigned __ARM_TPL_thread_hw_concurrency()