On Tue, 23 Jan 2024 22:31:25 +0000, [email protected] wrote: > I'm writing a program that uses sockets, and am facing a problem where I thin > k some threads block on a send() forever. I thought I could solve this by usi > ng an asynchronous write, and setting a timeout, but I cannot find anything a > bout this on OpenBSD. Is this just not available? I installed the POSIX manpa > ges and I can see aio stuff there, but it tells me to include a header that g > cc and clang won't find. Apparently FreeBSD has aio_write(), but seemingly Op > enBSD doesn't. What are the alternatives? Is there really no way to do this?
The normal way to do this is to mark the socket non-blocking, use something like poll(2) for the event loop and handle partial read/write appropriately. Many of the system daemons use libevent to help abstract this. - todd

