paparazzi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Paparazzi-devel] 40 msec sleep in ardrone/navdata.c


From: Ori Pessach
Subject: [Paparazzi-devel] 40 msec sleep in ardrone/navdata.c
Date: Sun, 1 Feb 2015 16:04:47 -0700

Hi,

I noticed this code in navdata.c:

// wait 40ms to retrieve data
// using 40 times a 1ms wait in case the usleep function
// is interupted by a signal

for (int i = 0; i < 40; i++) {
  usleep(1000);
}


Wouldn't it be bette to do it this way?

req.tv_sec=0;
req.tv_nsec=40 * 1000000L;
while(nanosleep(&req,&req)==-1)
  continue;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]