Rev 534 | Rev 1062 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 534 | Rev 623 | ||
|---|---|---|---|
| Line 35... | Line 35... | ||
| 35 | #include <arch/atomic.h> |
35 | #include <arch/atomic.h> |
| 36 | #include <proc/thread.h> |
36 | #include <proc/thread.h> |
| 37 | 37 | ||
| 38 | #include <arch.h> |
38 | #include <arch.h> |
| 39 | 39 | ||
| 40 | - | ||
| 41 | - | ||
| 42 | #define THREADS 5 |
40 | #define THREADS 5 |
| 43 | 41 | ||
| 44 | - | ||
| 45 | static void thread(void *data) |
42 | static void thread(void *data) |
| 46 | { |
43 | { |
| 47 | while(1) |
44 | while(1) |
| 48 | { |
45 | { |
| 49 | printf("%d\n",(int)(THREAD->tid)); |
46 | printf("%d\n",(int)(THREAD->tid)); |
| 50 | scheduler(); |
47 | scheduler(); |
| 51 | } |
48 | } |
| 52 | } |
49 | } |
| 53 | 50 | ||
| 54 | - | ||
| 55 | - | ||
| 56 | void test(void) |
51 | void test(void) |
| 57 | { |
52 | { |
| 58 | thread_t *t; |
53 | thread_t *t; |
| 59 | int i; |
54 | int i; |
| 60 | 55 | ||
| 61 | - | ||
| 62 | - | ||
| 63 | for (i=0; i<THREADS; i++) |
56 | for (i=0; i<THREADS; i++) { |
| 64 | { |
- | |
| 65 | if (!(t = thread_create(thread, NULL, TASK, 0))) |
57 | if (!(t = thread_create(thread, NULL, TASK, 0))) |
| 66 | panic("could not create thread\n"); |
58 | panic("could not create thread\n"); |
| 67 | thread_ready(t); |
59 | thread_ready(t); |
| 68 | } |
60 | } |
| 69 | printf("ok\n"); |
61 | printf("ok\n"); |
| 70 | - | ||
| 71 | } |
62 | } |