Centralized thread cancellation in processor_t
This ensures that no threads are active when plugins and the rest of the daemon are unloaded. callback_job_t was simplified a lot in the process as its main functionality is now contained in processor_t. The parent-child relationships were abandoned as these were only needed to simplify job cancellation.
This commit is contained in:
@@ -42,11 +42,6 @@ struct private_duplicheck_notify_t {
|
||||
*/
|
||||
duplicheck_notify_t public;
|
||||
|
||||
/**
|
||||
* Callback job dispatching connections
|
||||
*/
|
||||
callback_job_t *job;
|
||||
|
||||
/**
|
||||
* Mutex to lock list
|
||||
*/
|
||||
@@ -167,10 +162,6 @@ METHOD(duplicheck_notify_t, destroy, void,
|
||||
enumerator_t *enumerator;
|
||||
uintptr_t fd;
|
||||
|
||||
if (this->job)
|
||||
{
|
||||
this->job->cancel(this->job);
|
||||
}
|
||||
enumerator = this->connected->create_enumerator(this->connected);
|
||||
while (enumerator->enumerate(enumerator, &fd))
|
||||
{
|
||||
@@ -203,9 +194,9 @@ duplicheck_notify_t *duplicheck_notify_create()
|
||||
destroy(this);
|
||||
return NULL;
|
||||
}
|
||||
this->job = callback_job_create_with_prio((callback_job_cb_t)receive,
|
||||
this, NULL, NULL, JOB_PRIO_CRITICAL);
|
||||
lib->processor->queue_job(lib->processor, (job_t*)this->job);
|
||||
lib->processor->queue_job(lib->processor,
|
||||
(job_t*)callback_job_create_with_prio((callback_job_cb_t)receive, this,
|
||||
NULL, (callback_job_cancel_t)return_false, JOB_PRIO_CRITICAL));
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user