1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

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.
This commit is contained in:
Gunar Schorcht 2018-10-14 13:55:43 +02:00
parent fddfe86a4b
commit df1b6521f4

View File

@ -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;