g_rec_mutex_unlock(&channel->mutex);
g_rec_mutex_clear(&channel->mutex);
+ if (channel->fd > -1)
+ close(channel->fd);
+
free(channel);
}
if (condition & (AUL_IO_HUP | AUL_IO_ERR | AUL_IO_NVAL)) {
_E("IO error occurred. condition(%d), fd(%d)", condition, fd);
+ aul_worker_remove_io_job(worker, fd);
__remove_client_channel(channel);
__destroy_client_channel(channel);
- return false;
+ return true;
}
g_rec_mutex_lock(&channel->mutex);
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;
int fd, int condition, aul_worker_io_job_cb callback,
void *user_data);
+void aul_worker_remove_io_job(aul_worker_h handle, int fd);
+
int aul_worker_add_anr_timer(aul_worker_h handle, int cmd);
int aul_worker_remove_anr_timer(aul_worker_h handle);