add lumiera_threadpool_release_thread
make the test compile change from type to kind
This commit is contained in:
parent
9dd838b129
commit
10f79290a1
5 changed files with 16 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue