19
19
#include " mbed_assert.h"
20
20
21
21
UDPSocket::UDPSocket ()
22
- : _pending(0 ), _read_sem(0 ), _write_sem(0 ),
23
- _read_in_progress(false ), _write_in_progress(false )
22
+ : _pending(0 ), _read_sem(0 ), _write_sem(0 )
24
23
{
25
24
}
26
25
@@ -53,12 +52,6 @@ nsapi_size_or_error_t UDPSocket::sendto(const SocketAddress &address, const void
53
52
_lock.lock ();
54
53
nsapi_size_or_error_t ret;
55
54
56
- // If this assert is hit then there are two threads
57
- // performing a send at the same time which is undefined
58
- // behavior
59
- MBED_ASSERT (!_write_in_progress);
60
- _write_in_progress = true ;
61
-
62
55
while (true ) {
63
56
if (!_socket) {
64
57
ret = NSAPI_ERROR_NO_SOCKET;
@@ -87,7 +80,6 @@ nsapi_size_or_error_t UDPSocket::sendto(const SocketAddress &address, const void
87
80
}
88
81
}
89
82
90
- _write_in_progress = false ;
91
83
_lock.unlock ();
92
84
return ret;
93
85
}
@@ -97,12 +89,6 @@ nsapi_size_or_error_t UDPSocket::recvfrom(SocketAddress *address, void *buffer,
97
89
_lock.lock ();
98
90
nsapi_size_or_error_t ret;
99
91
100
- // If this assert is hit then there are two threads
101
- // performing a recv at the same time which is undefined
102
- // behavior
103
- MBED_ASSERT (!_read_in_progress);
104
- _read_in_progress = true ;
105
-
106
92
while (true ) {
107
93
if (!_socket) {
108
94
ret = NSAPI_ERROR_NO_SOCKET;
@@ -131,7 +117,6 @@ nsapi_size_or_error_t UDPSocket::recvfrom(SocketAddress *address, void *buffer,
131
117
}
132
118
}
133
119
134
- _read_in_progress = false ;
135
120
_lock.unlock ();
136
121
return ret;
137
122
}
0 commit comments