mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-10-21 15:41:41 +08:00
[libc] remove RT_USING_LIBC
This commit is contained in:
@@ -95,8 +95,8 @@ extern "C" unsigned __ARM_TPL_thread_hw_concurrency()
|
||||
extern "C" int __ARM_TPL_tls_create(__ARM_TPL_tls_key *__key,
|
||||
void (*__at_exit)(void *))
|
||||
{
|
||||
pthread_key_t key;
|
||||
|
||||
pthread_key_t key;
|
||||
|
||||
if (pthread_key_create(&key, __at_exit) == 0)
|
||||
{
|
||||
*__key = key;
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#error "C++ version lower than C++11"
|
||||
#endif
|
||||
|
||||
//#if defined(RT_USING_LIBC) && defined(RT_USING_PTHREADS)
|
||||
//#if defined(RT_USING_PTHREADS)
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
@@ -509,4 +509,4 @@ namespace std
|
||||
}
|
||||
}
|
||||
|
||||
//#endif // (RT_USING_LIBC) && (RT_USING_PTHREADS)
|
||||
//#endif //(RT_USING_PTHREADS)
|
@@ -34,7 +34,7 @@ namespace std
|
||||
get_once_functor_lock_ptr() = m_ptr;
|
||||
}
|
||||
|
||||
extern "C"
|
||||
extern "C"
|
||||
{
|
||||
void once_proxy()
|
||||
{
|
||||
@@ -42,7 +42,7 @@ namespace std
|
||||
function<void()> once_call = std::move(once_functor);
|
||||
|
||||
// no need to hold the lock anymore
|
||||
unique_lock<mutex>* lock_ptr = get_once_functor_lock_ptr();
|
||||
unique_lock<mutex>* lock_ptr = get_once_functor_lock_ptr();
|
||||
get_once_functor_lock_ptr() = nullptr;
|
||||
lock_ptr->unlock();
|
||||
|
||||
|
@@ -4,7 +4,7 @@
|
||||
#error "C++ version lower than C++11"
|
||||
#endif
|
||||
|
||||
//#if defined(RT_USING_LIBC) && defined(RT_USING_PTHREADS)
|
||||
//#if defined(RT_USING_PTHREADS)
|
||||
|
||||
#include <unistd.h>
|
||||
#include <pthread.h>
|
||||
|
@@ -35,17 +35,17 @@ namespace std
|
||||
{
|
||||
auto raw_ptr = b.get();
|
||||
// transfer the ownership of the invoker to the new thread
|
||||
raw_ptr->this_ptr = std::move(b);
|
||||
raw_ptr->this_ptr = std::move(b);
|
||||
int err = pthread_create(&_m_thr.__cpp_thread_t, NULL,
|
||||
&execute_native_thread_routine, raw_ptr);
|
||||
|
||||
if (err)
|
||||
if (err)
|
||||
{
|
||||
raw_ptr->this_ptr.reset();
|
||||
throw_system_error(err, "Failed to create a thread");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
thread::~thread()
|
||||
{
|
||||
@@ -59,12 +59,12 @@ namespace std
|
||||
|
||||
if (joinable())
|
||||
err = pthread_join(native_handle(), NULL);
|
||||
|
||||
if (err)
|
||||
|
||||
if (err)
|
||||
{
|
||||
throw_system_error(err, "thread::join failed");
|
||||
}
|
||||
|
||||
|
||||
_m_thr = id();
|
||||
}
|
||||
|
||||
@@ -78,14 +78,14 @@ namespace std
|
||||
{
|
||||
throw_system_error(err, "thread::detach failed");
|
||||
}
|
||||
|
||||
|
||||
_m_thr = id();
|
||||
}
|
||||
|
||||
// TODO: not yet actually implemented.
|
||||
// The standard states that the returned value should only be considered a hint.
|
||||
unsigned thread::hardware_concurrency() noexcept
|
||||
{
|
||||
unsigned thread::hardware_concurrency() noexcept
|
||||
{
|
||||
int __n = _RT_NPROCS;
|
||||
if (__n < 0)
|
||||
__n = 0;
|
||||
|
Reference in New Issue
Block a user