properly initialize and de-initialize the thread condition variable

This commit is contained in:
Michael Ploujnikov 2009-12-31 07:37:28 -05:00
parent c4e1fdaf9a
commit 03fe6dd658
2 changed files with 1 additions and 12 deletions

View file

@ -74,11 +74,9 @@ LumieraThread
lumiera_thread_run (enum lumiera_thread_class kind,
void (*function)(void *),
void * arg,
LumieraReccondition finished,
const char* purpose,
struct nobug_flag* flag)
{
(void)finished;
(void)function;
(void)arg;
// ask the threadpool for a thread (it might create a new one)
@ -101,7 +99,6 @@ lumiera_thread_run (enum lumiera_thread_class kind,
*/
LumieraThread
lumiera_thread_new (enum lumiera_thread_class kind,
LumieraReccondition finished,
const char* purpose,
struct nobug_flag* flag,
pthread_attr_t* attrs)
@ -112,12 +109,9 @@ lumiera_thread_new (enum lumiera_thread_class kind,
REQUIRE (kind < LUMIERA_THREADCLASS_COUNT, "invalid thread kind specified: %d", kind);
REQUIRE (attrs, "invalid pthread attributes structure passed");
//REQUIRE (finished, "invalid finished flag passed");
LumieraThread self = lumiera_malloc (sizeof (*self));
llist_init (&self->node);
self->finished = finished;
lumiera_reccondition_init (&self->finished, "thread-control-condition", flag);
self->kind = kind;
self->state = LUMIERA_THREADSTATE_IDLE;
@ -140,7 +134,6 @@ lumiera_thread_destroy (LumieraThread self)
// TODO: stop the pthread
llist_unlink (&self->node);
//finished = NULL; // or free(finished)?
lumiera_reccondition_destroy (self->finished, &NOBUG_FLAG (threads));
//kind = 0;
//state = 0;

View file

@ -137,7 +137,6 @@ struct lumiera_thread_struct
*/
LumieraThread
lumiera_thread_new (enum lumiera_thread_class kind,
LumieraReccondition finished,
const char* purpose,
struct nobug_flag* flag,
pthread_attr_t* attrs);
@ -169,8 +168,6 @@ lumiera_thread_delete (LumieraThread self);
* @param kind class of the thread to start
* @param function pointer to a function to execute in a thread (returning void, not void* as in pthreads)
* @param arg generic pointer passed to the thread
* @param finished a condition variable to be broadcasted, if not NULL.
* The associated mutex should be locked at thread_run time already, else the signal can get lost.
* @param purpose descriptive name of this thread, used by NoBug
* @param flag NoBug flag used for logging the thread startup and return
*/
@ -178,7 +175,6 @@ LumieraThread
lumiera_thread_run (enum lumiera_thread_class kind,
void (*function)(void *),
void * arg,
LumieraReccondition finished,
const char* purpose,
struct nobug_flag* flag);