Subversion Repositories HelenOS-historic

Rev

Rev 762 | Rev 783 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 762 Rev 777
Line 49... Line 49...
49
#include <arch/interrupt.h>
49
#include <arch/interrupt.h>
50
#include <smp/ipi.h>
50
#include <smp/ipi.h>
51
#include <arch/faddr.h>
51
#include <arch/faddr.h>
52
#include <arch/atomic.h>
52
#include <arch/atomic.h>
53
#include <memstr.h>
53
#include <memstr.h>
-
 
54
#include <print.h>
54
 
55
 
55
char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; /**< Thread states */
56
char *thread_states[] = {"Invalid", "Running", "Sleeping", "Ready", "Entering", "Exiting"}; /**< Thread states */
56
 
57
 
57
SPINLOCK_INITIALIZE(threads_lock);  /**< Lock protecting threads_head list. For locking rules, see declaration thereof. */
58
SPINLOCK_INITIALIZE(threads_lock);  /**< Lock protecting threads_head list. For locking rules, see declaration thereof. */
58
LIST_INITIALIZE(threads_head);      /**< List of all threads. */
59
LIST_INITIALIZE(threads_head);      /**< List of all threads. */
Line 316... Line 317...
316
    THREAD->call_me = call_me;
317
    THREAD->call_me = call_me;
317
    THREAD->call_me_with = call_me_with;
318
    THREAD->call_me_with = call_me_with;
318
    spinlock_unlock(&THREAD->lock);
319
    spinlock_unlock(&THREAD->lock);
319
    interrupts_restore(ipl);
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
}