[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
aio co-op with socket kqueue on Netbsd
Hello, I'm just a Windows programmer and now learning *nix APIs. I want to
know how people use aio and socket kqueue together.
Recently I'm learning I/O APIs and noticed that aio_* functions seeem to be
the only way to perform asynchronism I/O on disk files. The interface is
just like overlapped I/O on Windows. But the only usable way I found, to
wait for the operation's completion or to notice me that it finished, which
is usable on NetBSD, is the API aio_suspend.
I searched the Internet and found 4 ways to implement this: realtime signal,
kqueue, callback function and aio_suspend/aio_waitcomplete. Unluckily,
according to this (
document I know that currently NetBSD's kqueue doesn't support aio events.
Sigevent manual ( http://netbsd.gw.com/cgi-bin/man-cgi?sigevent ) shows that
neither realtime signal nor SIGEV_THREAD flag (by which callback
notification implement) is supported on NetBSD.
The existing practise to handle sockets in a network server prefers I/O
completion port on Windows, kqueue on *BSD and epoll on Linux. I/O
completion port handles file read/write operation as well, while kqueue on
FreeBSD seems (I have not yet tried) to work with aio operations. Through
fdevent/fdsignal API Linux handles signals via epoll. By this way there
won't be situation that a process or thread is "waiting for a single
operation" (synchronism I/O). So how could I use kqueue (to handle sockets)
and aio (to handle regular files on disk) on NetBSD to achieve the same goal?
By the way, since the realtime signal feature is not usable on NetBSD and
timer_create sends notice by realtime signal, does it mean that timer_create
will not work on NetBSD? So generally how a time-out feature is implement in
a network server on NetBSD?
Sorry for poor English.
Thanks in advance.
Main Index |
Thread Index |