diff options
author | Lennart Poettering <lennart@poettering.net> | 2005-10-16 01:04:07 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2005-10-16 01:04:07 +0000 |
commit | 9da0241b9c1bf751605ba11fa6d4c75e34fe5f2b (patch) | |
tree | 9d0369dc720ccef3585a7128094dd615e7584a6f /avahi-compat-libdns_sd | |
parent | 10bb2c127df147851330f6c06ba38198829d15e9 (diff) |
* fix compat-howl to work with nautilus
* make similar changes to compat-libdns_sd
* implement sw_salt_lock()/sw_salt_unlock() in compt-howl
* simple-watch: allows immediate rerunning of avahi_simple_poll_run()
git-svn-id: file:///home/lennart/svn/public/avahi/trunk@787 941a03a8-eaeb-0310-b9a0-b1bbd8fe43fe
Diffstat (limited to 'avahi-compat-libdns_sd')
-rw-r--r-- | avahi-compat-libdns_sd/compat.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/avahi-compat-libdns_sd/compat.c b/avahi-compat-libdns_sd/compat.c index e56168b..9b399d2 100644 --- a/avahi-compat-libdns_sd/compat.c +++ b/avahi-compat-libdns_sd/compat.c @@ -45,7 +45,8 @@ enum { COMMAND_POLL = 'p', COMMAND_QUIT = 'q', - COMMAND_POLL_DONE = 'P' + COMMAND_POLL_DONE = 'P', + COMMAND_POLL_FAILED = 'F' }; struct _DNSServiceRef_t { @@ -222,22 +223,32 @@ static void * thread_func(void *data) { switch (command) { - case COMMAND_POLL: + case COMMAND_POLL: { + int ret; ASSERT_SUCCESS(pthread_mutex_lock(&sdref->mutex)); - - if (avahi_simple_poll_run(sdref->simple_poll) < 0) { - fprintf(stderr, __FILE__": avahi_simple_poll_run() failed.\n"); - ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex)); + + for (;;) { + errno = 0; + + if ((ret = avahi_simple_poll_run(sdref->simple_poll)) < 0) { + + if (errno == EINTR) + continue; + + fprintf(stderr, __FILE__": avahi_simple_poll_run() failed: %s\n", strerror(errno)); + } + break; } ASSERT_SUCCESS(pthread_mutex_unlock(&sdref->mutex)); - if (write_command(sdref->thread_fd, COMMAND_POLL_DONE) < 0) + if (write_command(sdref->thread_fd, ret < 0 ? COMMAND_POLL_FAILED : COMMAND_POLL_DONE) < 0) break; break; + } case COMMAND_QUIT: return NULL; |