]> xenbits.xensource.com Git - people/vhanquez/xen-unstable.git/commitdiff
xenstore: block signals in watch wakeup thread
authorSimon Rowe <simon.rowe@eu.citrix.com>
Thu, 7 Jun 2012 17:22:20 +0000 (18:22 +0100)
committerSimon Rowe <simon.rowe@eu.citrix.com>
Thu, 7 Jun 2012 17:22:20 +0000 (18:22 +0100)
The thread created to wakeup watchers is not intended to handle signals
(and a later patch will reduce it's stack size which makes it unsuitable
for doing so).

Signed-off-by: Simon Rowe <simon.rowe@eu.citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/xenstore/xs.c

index f141066efc5e57acd657130787a0630c33f478cf..e12a4a3ca0eddaf466b69b9adb6988a0eadef8f4 100644 (file)
@@ -705,11 +705,18 @@ bool xs_watch(struct xs_handle *h, const char *path, const char *token)
        /* We dynamically create a reader thread on demand. */
        mutex_lock(&h->request_mutex);
        if (!h->read_thr_exists) {
+               sigset_t set, old_set;
+
+               sigfillset(&set);
+               pthread_sigmask(SIG_SETMASK, &set, &old_set);
+
                if (pthread_create(&h->read_thr, NULL, read_thread, h) != 0) {
+                       pthread_sigmask(SIG_SETMASK, &old_set, NULL);
                        mutex_unlock(&h->request_mutex);
                        return false;
                }
                h->read_thr_exists = 1;
+               pthread_sigmask(SIG_SETMASK, &old_set, NULL);
        }
        mutex_unlock(&h->request_mutex);
 #endif