ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/truck/DashInterface/Display.cpp
(Generate patch)

Comparing DashInterface/Display.cpp (file contents):
Revision 33 by douglas, 2008-02-29T19:05:18-08:00 vs.
Revision 37 by douglas, 2008-03-05T02:29:38-08:00

# Line 6 | Line 6
6  
7   #include <foreach.hpp>
8   #include <scopes.hpp>
9 + #include <timing.hpp>
10  
11   #include <iomanip>
12   #include <iostream>
# Line 175 | Line 176 | void Display::Communicate_()
176                                  responsesCondition.Signal();
177                          }
178  
179 < next:   ::usleep(500);
179 > next:   Timing::NanoSleep(Timing::Time(0, 10000000));
180          }
181   }
182  
# Line 183 | Line 184 | Display::Packet Display::Communicate_(Di
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  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines