diff --git a/features/netsocket/UDPSocket.cpp b/features/netsocket/UDPSocket.cpp index 0243a4b831..08f270cdd8 100644 --- a/features/netsocket/UDPSocket.cpp +++ b/features/netsocket/UDPSocket.cpp @@ -19,8 +19,7 @@ #include "mbed_assert.h" UDPSocket::UDPSocket() - : _pending(0), _read_sem(0), _write_sem(0), - _read_in_progress(false), _write_in_progress(false) + : _pending(0), _read_sem(0), _write_sem(0) { } @@ -53,12 +52,6 @@ nsapi_size_or_error_t UDPSocket::sendto(const SocketAddress &address, const void _lock.lock(); nsapi_size_or_error_t ret; - // If this assert is hit then there are two threads - // performing a send at the same time which is undefined - // behavior - MBED_ASSERT(!_write_in_progress); - _write_in_progress = true; - while (true) { if (!_socket) { ret = NSAPI_ERROR_NO_SOCKET; @@ -87,7 +80,6 @@ nsapi_size_or_error_t UDPSocket::sendto(const SocketAddress &address, const void } } - _write_in_progress = false; _lock.unlock(); return ret; } @@ -97,12 +89,6 @@ nsapi_size_or_error_t UDPSocket::recvfrom(SocketAddress *address, void *buffer, _lock.lock(); nsapi_size_or_error_t ret; - // If this assert is hit then there are two threads - // performing a recv at the same time which is undefined - // behavior - MBED_ASSERT(!_read_in_progress); - _read_in_progress = true; - while (true) { if (!_socket) { ret = NSAPI_ERROR_NO_SOCKET; @@ -131,7 +117,6 @@ nsapi_size_or_error_t UDPSocket::recvfrom(SocketAddress *address, void *buffer, } } - _read_in_progress = false; _lock.unlock(); return ret; } diff --git a/features/netsocket/UDPSocket.h b/features/netsocket/UDPSocket.h index 58584b9d83..9cc2d5d8e4 100644 --- a/features/netsocket/UDPSocket.h +++ b/features/netsocket/UDPSocket.h @@ -45,8 +45,7 @@ public: */ template UDPSocket(S *stack) - : _pending(0), _read_sem(0), _write_sem(0), - _read_in_progress(false), _write_in_progress(false) + : _pending(0), _read_sem(0), _write_sem(0) { open(stack); } @@ -120,8 +119,6 @@ protected: volatile unsigned _pending; rtos::Semaphore _read_sem; rtos::Semaphore _write_sem; - bool _read_in_progress; - bool _write_in_progress; };