[socket] Add LWIP_LOCK to socket factory functions

tcp_new() is an lwip core API call that must be bracketed with
the lwip lock on RP2040 per pico-sdk docs. Add LWIP_LOCK() to
socket() and socket_listen() factory functions.
This commit is contained in:
J. Nick Koston
2026-03-10 00:55:34 -10:00
parent c182c0c74f
commit cc05bf3ed2
@@ -781,6 +781,7 @@ std::unique_ptr<Socket> socket(int domain, int type, int protocol) {
errno = EPROTOTYPE;
return nullptr;
}
LWIP_LOCK();
auto *pcb = tcp_new();
if (pcb == nullptr)
return nullptr;
@@ -800,6 +801,7 @@ std::unique_ptr<ListenSocket> socket_listen(int domain, int type, int protocol)
errno = EPROTOTYPE;
return nullptr;
}
LWIP_LOCK();
auto *pcb = tcp_new();
if (pcb == nullptr)
return nullptr;