Changes in kernel/generic/src/proc/thread.c [df58e44:96b02eb9] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/proc/thread.c
rdf58e44 r96b02eb9 239 239 * Switch thread to the ready state. 240 240 * 241 * @param t hreadThread to make ready.241 * @param t 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) … … 338 338 339 339 thread->interrupted = false; 340 thread->btrace = false;341 340 thread->detached = false; 342 341 waitq_initialize(&thread->join_wq); … … 536 535 /** Detach thread. 537 536 * 538 * Mark the thread as detached . If the thread is already539 * in the Lingeringstate, deallocate its resources.537 * Mark the thread as detached, if the thread is already in the Lingering 538 * state, deallocate its resources. 540 539 * 541 540 * @param thread Thread to be detached. … … 741 740 ASSERT(interrupts_disabled()); 742 741 ASSERT(irq_spinlock_locked(&threads_lock)); 743 742 744 743 thread_iterator_t iterator; 745 744 … … 752 751 } 753 752 754 void thread_stack_trace(thread_id_t thread_id)755 {756 irq_spinlock_lock(&threads_lock, true);757 758 thread_t *thread = thread_find_by_id(thread_id);759 if (thread == NULL) {760 printf("No such thread.\n");761 irq_spinlock_unlock(&threads_lock, true);762 return;763 }764 765 irq_spinlock_lock(&thread->lock, false);766 767 /*768 * Schedule a stack trace to be printed769 * just before the thread is scheduled next.770 *771 * If the thread is sleeping then try to interrupt772 * the sleep. Any request for printing an uspace stack773 * trace from within the kernel should be always774 * considered a last resort debugging means, therefore775 * forcing the thread's sleep to be interrupted776 * is probably justifiable.777 */778 779 bool sleeping = false;780 istate_t *istate = thread->udebug.uspace_state;781 if (istate != NULL) {782 printf("Scheduling thread stack trace.\n");783 thread->btrace = true;784 if (thread->state == Sleeping)785 sleeping = true;786 } else787 printf("Thread interrupt state not available.\n");788 789 irq_spinlock_unlock(&thread->lock, false);790 791 if (sleeping)792 waitq_interrupt_sleep(thread);793 794 irq_spinlock_unlock(&threads_lock, true);795 }796 753 797 754 /** Process syscall to create new thread. … … 836 793 * has already been created. We need to undo its 837 794 * creation now. 795 * 838 796 */ 839 797 … … 857 815 * THREAD_B events for threads that already existed 858 816 * and could be detected with THREAD_READ before. 817 * 859 818 */ 860 819 udebug_thread_b_event_attach(thread, TASK);
Note:
See TracChangeset
for help on using the changeset viewer.