fixed daemon kill before threads are spawned
This commit is contained in:
@@ -121,12 +121,7 @@ static void cancel(private_callback_job_t *this)
|
|||||||
{
|
{
|
||||||
pthread_t thread;
|
pthread_t thread;
|
||||||
|
|
||||||
/* wait until thread has started */
|
|
||||||
pthread_mutex_lock(&this->mutex);
|
pthread_mutex_lock(&this->mutex);
|
||||||
while (this->thread == 0)
|
|
||||||
{
|
|
||||||
pthread_cond_wait(&this->condvar, &this->mutex);
|
|
||||||
}
|
|
||||||
thread = this->thread;
|
thread = this->thread;
|
||||||
|
|
||||||
/* terminate its children */
|
/* terminate its children */
|
||||||
@@ -134,8 +129,11 @@ static void cancel(private_callback_job_t *this)
|
|||||||
pthread_mutex_unlock(&this->mutex);
|
pthread_mutex_unlock(&this->mutex);
|
||||||
|
|
||||||
/* terminate thread */
|
/* terminate thread */
|
||||||
pthread_cancel(thread);
|
if (thread)
|
||||||
pthread_join(thread, NULL);
|
{
|
||||||
|
pthread_cancel(thread);
|
||||||
|
pthread_join(thread, NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user