Changeset 1871118 in mainline for kernel/generic/src/proc/scheduler.c
- Timestamp:
- 2023-02-10T22:59:11Z (2 years ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 11d2c983
- Parents:
- daadfa6
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-10 22:53:12)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-10 22:59:11)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/scheduler.c
rdaadfa6 r1871118 389 389 void scheduler_separated_stack(void) 390 390 { 391 DEADLOCK_PROBE_INIT(p_joinwq);392 391 task_t *old_task = TASK; 393 392 as_t *old_as = AS; … … 419 418 420 419 case Exiting: 421 repeat: 422 if (THREAD->detached) { 423 thread_destroy(THREAD, false); 424 } else { 425 /* 426 * The thread structure is kept allocated until 427 * somebody calls thread_detach() on it. 428 */ 429 if (!irq_spinlock_trylock(&THREAD->join_wq.lock)) { 430 /* 431 * Avoid deadlock. 432 */ 433 irq_spinlock_unlock(&THREAD->lock, false); 434 delay(HZ); 435 irq_spinlock_lock(&THREAD->lock, false); 436 DEADLOCK_PROBE(p_joinwq, 437 DEADLOCK_THRESHOLD); 438 goto repeat; 439 } 440 _waitq_wakeup_unsafe(&THREAD->join_wq, 441 WAKEUP_FIRST); 442 irq_spinlock_unlock(&THREAD->join_wq.lock, false); 443 444 THREAD->state = Lingering; 445 irq_spinlock_unlock(&THREAD->lock, false); 446 } 420 irq_spinlock_unlock(&THREAD->lock, false); 421 waitq_wakeup(&THREAD->join_wq, WAKEUP_CLOSE); 422 423 /* 424 * Release the reference CPU has for the thread. 425 * If there are no other references (e.g. threads calling join), 426 * the thread structure is deallocated. 427 */ 428 thread_put(THREAD); 447 429 break; 448 430 … … 556 538 size_t average; 557 539 size_t rdy; 558 559 /*560 * Detach kcpulb as nobody will call thread_join_timeout() on it.561 */562 thread_detach(THREAD);563 540 564 541 loop:
Note:
See TracChangeset
for help on using the changeset viewer.