Changeset 5b7a107 in mainline for kernel/generic/src/proc/thread.c
- Timestamp:
- 2011-01-27T16:52:14Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 875c629
- Parents:
- bf75e3cb (diff), df58e44 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/thread.c
rbf75e3cb r5b7a107 239 239 * Switch thread to the ready state. 240 240 * 241 * @param t Thread to make ready.241 * @param thread Thread to make ready. 242 242 * 243 243 */ … … 246 246 irq_spinlock_lock(&thread->lock, true); 247 247 248 ASSERT( !(thread->state == Ready));248 ASSERT(thread->state != Ready); 249 249 250 250 int i = (thread->priority < RQ_COUNT - 1) … … 350 350 351 351 #ifdef CONFIG_UDEBUG 352 /* Init debugging stuff */ 352 /* Initialize debugging stuff */ 353 thread->btrace = false; 353 354 udebug_thread_initialize(&thread->udebug); 354 355 #endif … … 535 536 /** Detach thread. 536 537 * 537 * Mark the thread as detached , if the thread is already in the Lingering538 * state, deallocate its resources.538 * Mark the thread as detached. If the thread is already 539 * in the Lingering state, deallocate its resources. 539 540 * 540 541 * @param thread Thread to be detached. … … 740 741 ASSERT(interrupts_disabled()); 741 742 ASSERT(irq_spinlock_locked(&threads_lock)); 742 743 743 744 thread_iterator_t iterator; 744 745 … … 751 752 } 752 753 754 #ifdef CONFIG_UDEBUG 755 756 void thread_stack_trace(thread_id_t thread_id) 757 { 758 irq_spinlock_lock(&threads_lock, true); 759 760 thread_t *thread = thread_find_by_id(thread_id); 761 if (thread == NULL) { 762 printf("No such thread.\n"); 763 irq_spinlock_unlock(&threads_lock, true); 764 return; 765 } 766 767 irq_spinlock_lock(&thread->lock, false); 768 769 /* 770 * Schedule a stack trace to be printed 771 * just before the thread is scheduled next. 772 * 773 * If the thread is sleeping then try to interrupt 774 * the sleep. Any request for printing an uspace stack 775 * trace from within the kernel should be always 776 * considered a last resort debugging means, therefore 777 * forcing the thread's sleep to be interrupted 778 * is probably justifiable. 779 */ 780 781 bool sleeping = false; 782 istate_t *istate = thread->udebug.uspace_state; 783 if (istate != NULL) { 784 printf("Scheduling thread stack trace.\n"); 785 thread->btrace = true; 786 if (thread->state == Sleeping) 787 sleeping = true; 788 } else 789 printf("Thread interrupt state not available.\n"); 790 791 irq_spinlock_unlock(&thread->lock, false); 792 793 if (sleeping) 794 waitq_interrupt_sleep(thread); 795 796 irq_spinlock_unlock(&threads_lock, true); 797 } 798 799 #endif /* CONFIG_UDEBUG */ 753 800 754 801 /** Process syscall to create new thread. … … 793 840 * has already been created. We need to undo its 794 841 * creation now. 795 *796 842 */ 797 843 … … 815 861 * THREAD_B events for threads that already existed 816 862 * and could be detected with THREAD_READ before. 817 *818 863 */ 819 864 udebug_thread_b_event_attach(thread, TASK);
Note:
See TracChangeset
for help on using the changeset viewer.