Re: [PATCH] Use nanosleep() instead of usleep()

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

 



On Mon, Aug 17, 2009 at 16:20, Daniel Mierswa<impulze@xxxxxxxxxxx> wrote:
>
> POSIX.1-2001  declares usleep() function obsolete and POSIX.1-2008
> removes it. Converted the calls to nanosleep().

+++ b/extras/modem-modeswitch/ma8280p_us.c
@@ -88,10 +88,19 @@
 #include <signal.h>
 #include <ctype.h>
 #include <usb.h>
+#include <time.h> /* nanosleep() */

Please drop such comments.

 #include "utils.h"
 #include "ma8280p_us.h"

+int nsleep(useconds_t usec)

This needs a better name. We better don't pass usecs to a function
called nsleep. :)


@@ -162,6 +163,7 @@ int udevadm_settle(struct udev *udev, int argc,
char *argv[])
 	/* guarantee that the udev daemon isn't pre-processing */
 	if (getuid() == 0) {
 		struct udev_ctrl *uctrl;
+		struct timespec time;

Is this used?


@@ -203,7 +206,10 @@ int udevadm_settle(struct udev *udev, int argc,
char *argv[])
 		if (is_timeout)
 			break;

-		usleep(1000 * 1000 / LOOP_PER_SECOND);
+		time.tv_sec = 0;
+		time.tv_nsec = 1000 * 1000 * 1000 / LOOP_PER_SECOND;
+
+		nanosleep(&time, NULL);

Please remove the newline in the middle of the logical block (several
occurences).

Thanks,
Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel]     [Linux DVB]     [Asterisk Internet PBX]     [DCCP]     [Netdev]     [X.org]     [Util Linux NG]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux