sched: rework file handling API

Replace SCH_*InputFileHandler() functions with more general
SCH_*FileHandler(), where events are specified as a new parameter and
which will later support other file events, e.g. file ready for ouput
and exception.

The file handlers have two new parameters: file descriptor and event.
This commit is contained in:
Miroslav Lichvar
2016-06-16 16:47:40 +02:00
parent aeb57a36b2
commit 0a10545314
7 changed files with 49 additions and 38 deletions

View File

@@ -72,7 +72,7 @@ start_resolving(void *anything)
/* ================================================== */
static void
end_resolving(void *anything)
end_resolving(int fd, int event, void *anything)
{
struct DNS_Async_Instance *inst = (struct DNS_Async_Instance *)anything;
int i;
@@ -83,7 +83,7 @@ end_resolving(void *anything)
resolving_threads--;
SCH_RemoveInputFileHandler(inst->pipe[0]);
SCH_RemoveFileHandler(inst->pipe[0]);
close(inst->pipe[0]);
close(inst->pipe[1]);
@@ -120,7 +120,7 @@ DNS_Name2IPAddressAsync(const char *name, DNS_NameResolveHandler handler, void *
LOG_FATAL(LOGF_Nameserv, "pthread_create() failed");
}
SCH_AddInputFileHandler(inst->pipe[0], end_resolving, inst);
SCH_AddFileHandler(inst->pipe[0], SCH_FILE_INPUT, end_resolving, inst);
}
/* ================================================== */