Changeset 55ab0f1 in mainline
- Timestamp:
- 2006-02-04T18:15:13Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 04225a7
- Parents:
- 428aabf
- Location:
- generic
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/include/proc/thread.h
r428aabf r55ab0f1 134 134 135 135 extern void thread_register_call_me(void (* call_me)(void *), void *call_me_with); 136 extern void thread_print_list(void); 136 137 137 138 #endif -
generic/src/console/cmd.c
r428aabf r55ab0f1 53 53 #include <mm/slab.h> 54 54 #include <proc/scheduler.h> 55 #include <proc/thread.h> 55 56 56 57 /** Data and methods for 'help' command. */ … … 245 246 }; 246 247 248 static int cmd_threads(cmd_arg_t *argv); 249 static cmd_info_t threads_info = { 250 .name = "threads", 251 .description = "List all threads", 252 .func = cmd_threads, 253 .argc = 0 254 }; 255 247 256 248 257 static int cmd_sched(cmd_arg_t *argv); … … 321 330 &symaddr_info, 322 331 &sched_info, 332 &threads_info, 323 333 &tlb_info, 324 334 &version_info, … … 598 608 } 599 609 610 611 /** Command for listings Thread information 612 * 613 * @param argv Ignores 614 * 615 * @return Always 1 616 */ 617 int cmd_threads(cmd_arg_t * argv) { 618 thread_print_list(); 619 return 1; 620 } 621 600 622 /** Command for listings Thread information 601 623 * -
generic/src/proc/thread.c
r428aabf r55ab0f1 52 52 #include <arch/atomic.h> 53 53 #include <memstr.h> 54 #include <print.h> 54 55 55 56 char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; /**< Thread states */ … … 319 320 interrupts_restore(ipl); 320 321 } 322 323 /** Print list of threads debug info */ 324 void thread_print_list(void) 325 { 326 link_t *cur; 327 thread_t *t; 328 ipl_t ipl; 329 330 /* Messing with thread structures, avoid deadlock */ 331 ipl = interrupts_disable(); 332 spinlock_lock(&threads_lock); 333 334 for (cur=threads_head.next; cur!=&threads_head; cur=cur->next) { 335 t = list_get_instance(cur, thread_t, threads_link); 336 printf("Thr: %d(%s) ", t->tid, thread_states[t->state]); 337 if (t->cpu) 338 printf("cpu%d ", t->cpu->id); 339 340 printf("\n"); 341 } 342 343 spinlock_unlock(&threads_lock); 344 interrupts_enable(); 345 }
Note:
See TracChangeset
for help on using the changeset viewer.