Changeset 9a1b20c in mainline for kernel/generic/src/proc/thread.c
- Timestamp:
- 2008-09-17T12:16:27Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fb9b0b0
- Parents:
- 06a195bc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/thread.c
r06a195bc r9a1b20c 181 181 } 182 182 183 #ifdef CONFIG_UDEBUG 184 mutex_initialize(&t->udebug.lock, MUTEX_PASSIVE); 185 #endif 186 183 187 return 0; 184 188 } … … 348 352 t->threads_tree_node.key = (uintptr_t) t; 349 353 354 #ifdef CONFIG_UDEBUG 355 /* Init debugging stuff */ 356 udebug_thread_initialize(&t->udebug); 357 #endif 358 350 359 /* might depend on previous initialization */ 351 360 thread_create_arch(t); … … 410 419 411 420 /* 412 * Attach to the currenttask.421 * Attach to the specified task. 413 422 */ 414 423 ipl = interrupts_disable(); 415 424 spinlock_lock(&task->lock); 425 416 426 atomic_inc(&task->refcount); 417 atomic_inc(&task->lifecount); 427 428 /* Must not count kbox thread into lifecount */ 429 if (t->flags & THREAD_FLAG_USPACE) 430 atomic_inc(&task->lifecount); 431 418 432 list_append(&t->th_link, &task->th_head); 419 433 spinlock_unlock(&task->lock); … … 438 452 ipl_t ipl; 439 453 440 if (atomic_predec(&TASK->lifecount) == 0) { 441 /* 442 * We are the last thread in the task that still has not exited. 443 * With the exception of the moment the task was created, new 444 * threads can only be created by threads of the same task. 445 * We are safe to perform cleanup. 446 */ 447 if (THREAD->flags & THREAD_FLAG_USPACE) { 454 if (THREAD->flags & THREAD_FLAG_USPACE) { 455 #ifdef CONFIG_UDEBUG 456 /* Generate udebug THREAD_E event */ 457 udebug_thread_e_event(); 458 #endif 459 if (atomic_predec(&TASK->lifecount) == 0) { 460 /* 461 * We are the last userspace thread in the task that 462 * still has not exited. With the exception of the 463 * moment the task was created, new userspace threads 464 * can only be created by threads of the same task. 465 * We are safe to perform cleanup. 466 */ 448 467 ipc_cleanup(); 449 468 futex_cleanup(); … … 742 761 thread_ready(t); 743 762 763 #ifdef CONFIG_UDEBUG 764 /* Generate udebug THREAD_B event */ 765 udebug_thread_b_event(t); 766 #endif 767 744 768 return 0; 745 769 } else
Note:
See TracChangeset
for help on using the changeset viewer.