From f410026b7bc96dbb42fec3839dc5d2e41b12f4a4 Mon Sep 17 00:00:00 2001 From: "Luke T. Shumaker" Date: Sat, 28 Sep 2024 20:50:36 -0600 Subject: misc --- libnetio/include/libnetio/netio.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'libnetio/include') diff --git a/libnetio/include/libnetio/netio.h b/libnetio/include/libnetio/netio.h index 9383c54..370d2ca 100644 --- a/libnetio/include/libnetio/netio.h +++ b/libnetio/include/libnetio/netio.h @@ -12,7 +12,14 @@ int netio_listen(uint16_t port); int netio_accept(int sock); /** Return bytes-read on success, 0 on EOF, -errno on error; a short read is *not* an error. */ ssize_t netio_read(int conn, void *buf, size_t count); -/** Return `count` on success, -errno on error; a short write *is* an error. */ +/** + * Return `count` on success, -errno on error; a short write *is* an + * error. + * + * Writes are *not* guaranteed to be atomic (as this would be + * expensive to implement), so if you have concurrent writers then you + * should arrange for a mutex to protect the connection. + */ ssize_t netio_write(int conn, void *buf, size_t count); /** Return 0 on success, -errno on error. */ int netio_close(int conn, bool rd, bool wr); -- cgit v1.2.3-2-g168b