Rev 842 | Rev 1658 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 842 | Rev 1062 | ||
|---|---|---|---|
| Line 120... | Line 120... | ||
| 120 | condvar_t thread_starter; |
120 | condvar_t thread_starter; |
| 121 | mutex_t starter_mutex; |
121 | mutex_t starter_mutex; |
| 122 | 122 | ||
| 123 | #define THREADS 8 |
123 | #define THREADS 8 |
| 124 | 124 | ||
| 125 | static void thread(void *priv) |
125 | static void slabtest(void *priv) |
| 126 | { |
126 | { |
| 127 | void *data=NULL, *new; |
127 | void *data=NULL, *new; |
| 128 | 128 | ||
| 129 | mutex_lock(&starter_mutex); |
129 | mutex_lock(&starter_mutex); |
| 130 | condvar_wait(&thread_starter,&starter_mutex); |
130 | condvar_wait(&thread_starter,&starter_mutex); |
| Line 186... | Line 186... | ||
| 186 | thr_cache = slab_cache_create("thread_cache", size, 0, |
186 | thr_cache = slab_cache_create("thread_cache", size, 0, |
| 187 | NULL, NULL, |
187 | NULL, NULL, |
| 188 | 0); |
188 | 0); |
| 189 | semaphore_initialize(&thr_sem,0); |
189 | semaphore_initialize(&thr_sem,0); |
| 190 | for (i=0; i<THREADS; i++) { |
190 | for (i=0; i<THREADS; i++) { |
| 191 | if (!(t = thread_create(thread, NULL, TASK, 0))) |
191 | if (!(t = thread_create(slabtest, NULL, TASK, 0, "slabtest"))) |
| 192 | panic("could not create thread\n"); |
192 | panic("could not create thread\n"); |
| 193 | thread_ready(t); |
193 | thread_ready(t); |
| 194 | } |
194 | } |
| 195 | thread_sleep(1); |
195 | thread_sleep(1); |
| 196 | condvar_broadcast(&thread_starter); |
196 | condvar_broadcast(&thread_starter); |