Fix is_socket_ready comment: main loop only, not thread-safe

This commit is contained in:
J. Nick Koston
2026-02-23 22:07:58 -06:00
parent 5a378143e2
commit 63a144fb43

View File

@@ -495,9 +495,10 @@ class Application {
/// @return true if registration was successful, false if fd exceeds limits
bool register_socket_fd(int fd);
void unregister_socket_fd(int fd);
/// Check if there's data available on a socket without blocking
/// This function is thread-safe for reading, but should be called after select() has run
/// The read_fds_ is only modified by select() in the main loop
/// Check if there's data available on a socket without blocking.
/// Must only be called from the main loop thread — on ESP32, the underlying
/// lwip_socket_dbg_get_socket() has no refcount, so socket lifetime safety
/// depends on both reads and close happening on the same thread.
bool is_socket_ready(int fd) const { return fd >= 0 && this->is_socket_ready_(fd); }
#ifdef USE_WAKE_LOOP_THREADSAFE