Changeset 2a46e10 in mainline
- Timestamp:
- 2006-02-16T13:35:02Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3debedec
- Parents:
- ff4e1cd
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
generic/src/proc/thread.c
rff4e1cd r2a46e10 96 96 thread_t *t = (thread_t *)obj; 97 97 pfn_t pfn; 98 int status; 98 99 99 100 spinlock_initialize(&t->lock, "thread_t_lock"); … … 103 104 link_initialize(&t->threads_link); 104 105 105 pfn = frame_alloc(ONE_FRAME, FRAME_KA | kmflags); 106 pfn = frame_alloc_rc(ONE_FRAME, FRAME_KA | kmflags,&status); 107 if (status) 108 return -1; 106 109 t->kstack = (__u8 *)PA2KA(PFN2ADDR(pfn)); 107 if (!t->kstack)108 return -1;109 110 110 111 return 0; … … 230 231 231 232 t = (thread_t *) slab_alloc(thread_slab, 0); 233 if (!t) 234 return NULL; 232 235 233 236 /* Not needed, but good for debugging */ -
test/mm/slab2/test.c
rff4e1cd r2a46e10 35 35 #include <mm/frame.h> 36 36 #include <memstr.h> 37 #include <synch/condvar.h> 38 #include <synch/mutex.h> 37 39 38 40 #define ITEM_SIZE 256 … … 116 118 slab_cache_t *thr_cache; 117 119 semaphore_t thr_sem; 120 condvar_t thread_starter; 121 mutex_t starter_mutex; 118 122 119 123 #define THREADS 8 … … 123 127 void *data=NULL, *new; 124 128 129 mutex_lock(&starter_mutex); 130 condvar_wait(&thread_starter,&starter_mutex); 131 mutex_unlock(&starter_mutex); 132 125 133 printf("Starting thread #%d...\n",THREAD->tid); 126 134 … … 173 181 174 182 printf("Running stress test with size %d\n", size); 183 condvar_initialize(&thread_starter); 184 mutex_initialize(&starter_mutex); 185 175 186 thr_cache = slab_cache_create("thread_cache", size, 0, 176 187 NULL, NULL, … … 182 193 thread_ready(t); 183 194 } 195 thread_sleep(1); 196 condvar_broadcast(&thread_starter); 184 197 185 198 for (i=0; i<THREADS; i++)
Note:
See TracChangeset
for help on using the changeset viewer.