bug-guix
[Top][All Lists]
Advanced

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

bug#30365: Offloading sometimes hangs


From: Danny Milosavljevic
Subject: bug#30365: Offloading sometimes hangs
Date: Thu, 15 Feb 2018 01:06:04 +0100

Hi Ludo,

> On the Guile side, we’ll have to push the fix for
> <https://bugs.gnu.org/30368>.

Can't think of a way to test select.  But can think of a way to test pselect:

Excuse the C:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/select.h>
#include <signal.h>

static void dummy(int signum) {
}

int main() {
        int fds[2];
        struct sigaction sa = {
                .sa_handler = dummy,
                .sa_flags = 0,
        };
        sigemptyset(&sa.sa_mask);
        pipe(fds);
        /* Make sure we don't miss it */
        sigsetmask(sigmask(SIGCHLD));
        /* Make sure we handle it once we DO get it (after unblocking it :P) */
        sigaction(SIGCHLD, &sa, NULL);
        if (fork() == 0) {
                _exit(0); /* Cause SIGCHLD (to be at least pending) in the 
parent. */
        } else {
                close(fds[0]);
                fd_set read_set;
                fd_set write_set;
                fd_set except_set;
                sigset_t sigmask;
                int rc;
                FD_ZERO(&read_set);
                FD_ZERO(&write_set);
                FD_SET(fds[1], &write_set);
                FD_ZERO(&except_set);
                sigemptyset(&sigmask); /* unblock SIGCHLD */
                rc = pselect(fds[0] + 1, &read_set, &write_set, &except_set, 
NULL, &sigmask);
                if (rc == -1) {
                        perror("select");
                } else if (rc == 0) {
                        printf("ZERO\n");
                } else {
                        printf("N\n");
                }
        }
        return 0;
}





reply via email to

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