diff options
| author | Man, Jianting (Meco) <[email protected]> | 2022-01-10 14:25:46 -0500 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-01-10 14:25:46 -0500 |
| commit | c6852aa306d07932bc1a62118029ac332acc3fc9 (patch) | |
| tree | 035cae3629b0a8a63686ffd5212162a334bfeeff /components/cplusplus/cpp11/gcc/thread.cpp | |
| parent | 1f2e93f1a39590af9a71ecc31b12045696ca6055 (diff) | |
| parent | 982ad7bcbcbdc31305883803fadf63bad72dbc73 (diff) | |
Merge branch 'master' into removeinit
Diffstat (limited to 'components/cplusplus/cpp11/gcc/thread.cpp')
| -rw-r--r-- | components/cplusplus/cpp11/gcc/thread.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/components/cplusplus/cpp11/gcc/thread.cpp b/components/cplusplus/cpp11/gcc/thread.cpp index 947170da25..3979da0dc4 100644 --- a/components/cplusplus/cpp11/gcc/thread.cpp +++ b/components/cplusplus/cpp11/gcc/thread.cpp @@ -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; |
