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 36 by douglas, 2008-03-04T22:24:35-08:00

# Line 175 | Line 175 | void Display::Communicate_()
175                                  responsesCondition.Signal();
176                          }
177  
178 < next:   ::usleep(500);
178 > next:   ::usleep(10000);
179          }
180   }
181  
# Line 183 | Line 183 | Display::Packet Display::Communicate_(Di
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  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines