add lumiera_threadpool_release_thread

make the test compile
change from type to kind
This commit is contained in:
Michael Ploujnikov 2009-11-23 16:51:18 -05:00
parent 9dd838b129
commit 10f79290a1
5 changed files with 16 additions and 8 deletions

View file

@ -85,6 +85,14 @@ lumiera_threadpool_acquire_thread(enum lumiera_thread_class kind,
}
}
void
lumiera_threadpool_release_thread(LumieraThread thread)
{
// TODO: do we need to check that index 'kind' is within range?
llist pool = threadpool.kind[thread->kind].pool;
llist_insert_head(&pool, &thread->node);
}
/*
// Local Variables:
// mode: C

View file

@ -161,7 +161,7 @@ lumiera_thread_new (enum lumiera_thread_class kind,
llist_init(&self->node);
// self->id = (pthread_t)NULL; initialized by pthread_create()
self->finished = finished;
self->type = kind;
self->kind = kind;
self->state = LUMIERA_THREADSTATE_IDLE;
printf("creating a thread\n");

View file

@ -105,7 +105,7 @@ struct lumiera_thread_struct
// void* arg;
pthread_t id;
LumieraReccondition finished;
enum lumiera_thread_class type;
enum lumiera_thread_class kind;
lumiera_thread_state state;
};

View file

@ -4,9 +4,9 @@ TEST "Acquire/Release test" basic-acquire-release <<END
out: start by initializing the threadpool
out: acquiring thread 1
out: acquiring thread 2
out: thread 1 type=0
out: thread 1 kind=0
out: thread 1 state=0
out: thread 2 type=4
out: thread 2 kind=4
out: thread 2 state=0
out: releasing thread 1
out: thread 1 has been released

View file

@ -44,10 +44,10 @@ TEST ("basic-acquire-release")
"test purpose",
NULL);
printf("thread 1 type=%d\n", t1.type);
printf("thread 1 state=%d\n", t1.state);
printf("thread 2 type=%d\n", t2.type);
printf("thread 2 state=%d\n", t2.state);
printf("thread 1 kind=%d\n", t1->kind);
printf("thread 1 state=%d\n", t1->state);
printf("thread 2 kind=%d\n", t2->kind);
printf("thread 2 state=%d\n", t2->state);
printf("releasing thread 1\n");
lumiera_threadpool_release_thread(t1);