diff options
author | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-09-28 20:50:36 -0600 |
---|---|---|
committer | Luke T. Shumaker <lukeshu@lukeshu.com> | 2024-09-28 20:54:43 -0600 |
commit | f410026b7bc96dbb42fec3839dc5d2e41b12f4a4 (patch) | |
tree | 22e831eb47101ee4e3635fcaf2729a81a178823c /libnetio/include | |
parent | f898850c2b4fef03f0d175ec052b3725bd406496 (diff) |
misc
Diffstat (limited to 'libnetio/include')
-rw-r--r-- | libnetio/include/libnetio/netio.h | 9 |
1 files changed, 8 insertions, 1 deletions
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); |