Use nanosleep instead of poll.
authorTilghman Lesher <tilghman@meg.abyt.es>
Mon, 20 Apr 2009 22:10:25 +0000 (22:10 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Mon, 20 Apr 2009 22:10:25 +0000 (22:10 +0000)
This is not just because mmichelson suggested it, but also because Mac OS X puked on my poll().

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@189539 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/stdtime/localtime.c

index 59bccf7..925ef02 100644 (file)
@@ -239,6 +239,7 @@ static void *inotify_daemon(void *data)
        } buf;
        ssize_t res;
        struct state *cur;
+       struct timespec ten_seconds = { 10, 0 };
 
        inotify_fd = inotify_init();
 
@@ -261,7 +262,7 @@ static void *inotify_daemon(void *data)
                } else if (res < 0) {
                        if (errno == EINTR || errno == EAGAIN) {
                                /* If read fails, then wait a bit, then continue */
-                               poll(NULL, 0, 10000);
+                               nanosleep(&ten_seconds, NULL);
                                continue;
                        }
                        /* Sanity check -- this should never happen, either */
@@ -322,6 +323,7 @@ static void *notify_daemon(void *data)
 {
        struct stat st, lst;
        struct state *cur;
+       struct timespec sixty_seconds = { 60, 0 };
 
        ast_mutex_lock(&initialization_lock);
        ast_cond_signal(&initialization);
@@ -330,7 +332,7 @@ static void *notify_daemon(void *data)
        for (;/*ever*/;) {
                char            fullname[FILENAME_MAX + 1];
 
-               poll(NULL, 0, 60000);
+               nanosleep(&sixty_seconds, NULL);
                AST_LIST_LOCK(&zonelist);
                AST_LIST_TRAVERSE_SAFE_BEGIN(&zonelist, cur, list) {
                        char *name = cur->name;