6 |
|
|
7 |
|
#include <foreach.hpp> |
8 |
|
#include <scopes.hpp> |
9 |
+ |
#include <timing.hpp> |
10 |
|
|
11 |
|
#include <iomanip> |
12 |
|
#include <iostream> |
176 |
|
responsesCondition.Signal(); |
177 |
|
} |
178 |
|
|
179 |
< |
next: ::usleep(500); |
179 |
> |
next: Timing::NanoSleep(Timing::Time(0, 10000000)); |
180 |
|
} |
181 |
|
} |
182 |
|
|
184 |
|
{ |
185 |
|
Packet packet(command, length, data); |
186 |
|
|
187 |
+ |
retry: |
188 |
|
_synchronized (ucomLock) |
189 |
|
ucom << packet; |
190 |
|
|
191 |
|
_synchronized (responsesLock) |
192 |
|
{ |
193 |
|
while (responses.empty()) |
194 |
< |
responsesCondition.Wait(); |
194 |
> |
try |
195 |
> |
{ |
196 |
> |
responsesCondition.Wait(Timing::GetTimeOfDay() += 1); |
197 |
> |
} |
198 |
> |
catch (const Posix::Error &error) |
199 |
> |
{ |
200 |
> |
if (error.what() != _B("Operation timed out")) |
201 |
> |
throw error; |
202 |
> |
|
203 |
> |
goto retry; |
204 |
> |
} |
205 |
|
|
206 |
|
Packet response(responses.front()); |
207 |
|
|