Commit 368392ea authored by Joseph Noir's avatar Joseph Noir

Fix detach call and adjsuted destructor

Release the pointer to the stack and set the handle to uninitialized,
also don't decrement the stack count if thread object is destroy, but
does not hold a handle to a valid thread.
parent 1c8c83f1
...@@ -9,6 +9,7 @@ namespace caf { ...@@ -9,6 +9,7 @@ namespace caf {
thread::~thread() { thread::~thread() {
// not needed, as our thread is always detachted // not needed, as our thread is always detachted
if (m_stack && m_handle != thread_uninitialized) {
//sched_task_exit(); //sched_task_exit();
//dINT(); //dINT();
//sched_threads[sched_active_pid] = NULL; //sched_threads[sched_active_pid] = NULL;
...@@ -16,6 +17,7 @@ thread::~thread() { ...@@ -16,6 +17,7 @@ thread::~thread() {
//sched_set_status((tcb_t *)sched_active_thread, STATUS_STOPPED); //sched_set_status((tcb_t *)sched_active_thread, STATUS_STOPPED);
//sched_active_thread = NULL; //sched_active_thread = NULL;
//cpu_switch_context_exit(); //cpu_switch_context_exit();
}
} }
void thread::join() { void thread::join() {
...@@ -24,6 +26,10 @@ void thread::join() { ...@@ -24,6 +26,10 @@ void thread::join() {
void thread::detach() { void thread::detach() {
// I believe there is no equivalent on RIOT // I believe there is no equivalent on RIOT
if (m_stack) {
m_stack.release();
m_handle = thread_uninitialized;
}
} }
unsigned thread::hardware_concurrency() noexcept { unsigned thread::hardware_concurrency() noexcept {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment