175 |
|
responsesCondition.Signal(); |
176 |
|
} |
177 |
|
|
178 |
< |
next: ::usleep(500); |
178 |
> |
next: ::usleep(10000); |
179 |
|
} |
180 |
|
} |
181 |
|
|
183 |
|
{ |
184 |
|
Packet packet(command, length, data); |
185 |
|
|
186 |
+ |
retry: |
187 |
|
_synchronized (ucomLock) |
188 |
|
ucom << packet; |
189 |
|
|
190 |
|
_synchronized (responsesLock) |
191 |
|
{ |
192 |
|
while (responses.empty()) |
193 |
< |
responsesCondition.Wait(); |
193 |
> |
try |
194 |
> |
{ |
195 |
> |
timeval when; |
196 |
> |
|
197 |
> |
::gettimeofday(&when, NULL); |
198 |
> |
|
199 |
> |
timespec wait; |
200 |
> |
|
201 |
> |
TIMEVAL_TO_TIMESPEC(&when, &wait); |
202 |
> |
|
203 |
> |
++wait.tv_sec; |
204 |
> |
|
205 |
> |
responsesCondition.Wait(wait); |
206 |
> |
} |
207 |
> |
catch (const Posix::Error &error) |
208 |
> |
{ |
209 |
> |
if (error.what() != _B("Operation timed out")) |
210 |
> |
throw error; |
211 |
> |
|
212 |
> |
goto retry; |
213 |
> |
} |
214 |
|
|
215 |
|
Packet response(responses.front()); |
216 |
|
|