Changeset 11d2c983 in mainline
- Timestamp:
- 2023-02-11T18:35:15Z (23 months ago)
- Branches:
- master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 76e17d7c
- Parents:
- 1871118
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-07 18:02:51)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2023-02-11 18:35:15)
- Location:
- kernel/generic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/proc/task.h
r1871118 r11d2c983 89 89 atomic_size_t refcount; 90 90 /** Number of threads that haven't exited yet. */ 91 // TODO: remove 91 92 atomic_size_t lifecount; 92 93 -
kernel/generic/src/proc/thread.c
r1871118 r11d2c983 398 398 * Detach thread from all queues, cpus etc. and destroy it. 399 399 * 400 * @param thread Thread to be destroyed. 401 * @param irq_res Indicate whether it should unlock thread->lock 402 * in interrupts-restore mode. 400 * @param obj Thread to be destroyed. 403 401 * 404 402 */ … … 407 405 thread_t *thread = (thread_t *) obj; 408 406 409 irq_spinlock_lock(&thread->lock, true); 407 assert_link_not_used(&thread->rq_link); 408 assert_link_not_used(&thread->wq_link); 409 410 assert(thread->task); 411 412 ipl_t ipl = interrupts_disable(); 413 414 /* Remove thread from task's list. */ 415 irq_spinlock_lock(&thread->task->lock, false); 416 list_remove(&thread->th_link); 417 irq_spinlock_unlock(&thread->task->lock, false); 418 419 /* Remove thread from global list. */ 420 irq_spinlock_lock(&threads_lock, false); 421 odict_remove(&thread->lthreads); 422 irq_spinlock_unlock(&threads_lock, false); 423 424 /* Clear cpu->fpu_owner if set to this thread. */ 425 irq_spinlock_lock(&thread->lock, false); 426 410 427 assert((thread->state == Exiting) || (thread->state == Lingering)); 411 assert(thread->task);412 428 assert(thread->cpu); 413 429 … … 417 433 irq_spinlock_unlock(&thread->cpu->lock, false); 418 434 419 irq_spinlock_pass(&thread->lock, &threads_lock); 420 421 odict_remove(&thread->lthreads); 422 423 irq_spinlock_pass(&threads_lock, &thread->task->lock); 424 425 /* 426 * Detach from the containing task. 427 */ 428 list_remove(&thread->th_link); 429 irq_spinlock_unlock(&thread->task->lock, true); 435 irq_spinlock_unlock(&thread->lock, false); 436 437 interrupts_restore(ipl); 430 438 431 439 /* … … 433 441 */ 434 442 task_release(thread->task); 443 thread->task = NULL; 444 435 445 slab_free(thread_cache, thread); 436 446 }
Note:
See TracChangeset
for help on using the changeset viewer.