Subversion Repositories HelenOS-historic

Compare Revisions

Ignore whitespace Rev 842 → Rev 841

/kernel/trunk/generic/src/proc/thread.c
95,7 → 95,6
{
thread_t *t = (thread_t *)obj;
pfn_t pfn;
int status;
 
spinlock_initialize(&t->lock, "thread_t_lock");
link_initialize(&t->rq_link);
103,10 → 102,10
link_initialize(&t->th_link);
link_initialize(&t->threads_link);
pfn = frame_alloc_rc(ONE_FRAME, FRAME_KA | kmflags,&status);
if (status)
pfn = frame_alloc(ONE_FRAME, FRAME_KA | kmflags);
t->kstack = (__u8 *)PA2KA(PFN2ADDR(pfn));
if (!t->kstack)
return -1;
t->kstack = (__u8 *)PA2KA(PFN2ADDR(pfn));
 
return 0;
}
230,8 → 229,6
ipl_t ipl;
t = (thread_t *) slab_alloc(thread_slab, 0);
if (!t)
return NULL;
/* Not needed, but good for debugging */
memsetb((__address)t->kstack, THREAD_STACK_SIZE, 0);
/kernel/trunk/test/mm/slab2/test.c
34,8 → 34,6
#include <panic.h>
#include <mm/frame.h>
#include <memstr.h>
#include <synch/condvar.h>
#include <synch/mutex.h>
 
#define ITEM_SIZE 256
 
117,8 → 115,6
 
slab_cache_t *thr_cache;
semaphore_t thr_sem;
condvar_t thread_starter;
mutex_t starter_mutex;
 
#define THREADS 8
 
126,10 → 122,6
{
void *data=NULL, *new;
 
mutex_lock(&starter_mutex);
condvar_wait(&thread_starter,&starter_mutex);
mutex_unlock(&starter_mutex);
printf("Starting thread #%d...\n",THREAD->tid);
 
/* Alloc all */
180,9 → 172,6
int i;
 
printf("Running stress test with size %d\n", size);
condvar_initialize(&thread_starter);
mutex_initialize(&starter_mutex);
 
thr_cache = slab_cache_create("thread_cache", size, 0,
NULL, NULL,
0);
192,8 → 181,6
panic("could not create thread\n");
thread_ready(t);
}
thread_sleep(1);
condvar_broadcast(&thread_starter);
 
for (i=0; i<THREADS; i++)
semaphore_down(&thr_sem);