Skip to content
Snippets Groups Projects
Commit df1b6521 authored by Gunar Schorcht's avatar Gunar Schorcht
Browse files

cpu/esp32: fixes the problem with tests/pthread_*

Reason for the problem was that tast_exit function in thread_arch.c tried to release the thread a second time although it was already released in sched_task_exit. A simple check whether the thread is already released (sched_active_thread == NULL) solved the problem.
parent fddfe86a
No related branches found
No related tags found
No related merge requests found
......@@ -335,15 +335,18 @@ static bool _initial_exit = true;
*/
NORETURN void task_exit(void)
{
DEBUG("sched_task_exit: ending thread %" PRIkernel_pid "...\n", sched_active_thread->pid);
DEBUG("sched_task_exit: ending thread %" PRIkernel_pid "...\n",
sched_active_thread ? sched_active_thread->pid : KERNEL_PID_UNDEF);
(void) irq_disable();
/* remove old task from scheduling */
sched_threads[sched_active_pid] = NULL;
sched_num_threads--;
sched_set_status((thread_t *)sched_active_thread, STATUS_STOPPED);
sched_active_thread = NULL;
/* remove old task from scheduling if it is not already done */
if (sched_active_thread) {
sched_threads[sched_active_pid] = NULL;
sched_num_threads--;
sched_set_status((thread_t *)sched_active_thread, STATUS_STOPPED);
sched_active_thread = NULL;
}
/* determine the new running task */
sched_run();
......@@ -370,6 +373,8 @@ NORETURN void task_exit(void)
NORETURN void cpu_switch_context_exit(void)
{
DEBUG("%s\n", __func__);
/* Switch context to the highest priority ready task without context save */
if (_initial_exit) {
_initial_exit = false;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment