diff options
Diffstat (limited to 'src/aul_worker.c')
-rw-r--r-- | src/aul_worker.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/aul_worker.c b/src/aul_worker.c index 3593bb2c..6a9137cd 100644 --- a/src/aul_worker.c +++ b/src/aul_worker.c @@ -286,6 +286,34 @@ int aul_worker_add_io_job(aul_worker_h handle, const char *job_name, return AUL_R_OK; } +void aul_worker_remove_io_job(aul_worker_h handle, int fd) +{ + struct aul_worker_s *worker = handle; + struct job_s *job; + GList *iter; + + if (worker == NULL || fd < 0) { + _E("Invalid parameter"); + return; + } + + g_mutex_lock(&worker->mutex); + iter = worker->jobs; + while (iter != NULL) { + job = iter->data; + iter = g_list_next(iter); + if (job->channel == NULL) + continue; + + if (g_io_channel_unix_get_fd(job->channel) == fd) { + worker->jobs = g_list_remove(worker->jobs, job); + __destroy_job(job); + break; + } + } + g_mutex_unlock(&worker->mutex); +} + void aul_worker_destroy(aul_worker_h handle) { struct aul_worker_s *worker = (struct aul_worker_s *)handle; |