Database/server.c
void *monitor_signal(void *arg) {
    // TODO: Wait for a SIGINT to be sent to the server process and cancel
    // all client threads when one arrives.

    sig_handler_t *signal_handler = (sig_handler_t*)arg;
	signal_handler->thread = pthread_self();
    sigset_t set = signal_handler->set;
    int sig;
    sigwait(&set, &sig);

    // program terminates with SIGINT
    delete_all();
    return NULL;
}
// Code executed by the signal handler thread. For the purpose of this
// assignment, there are two reasonable ways to implement this.
// The one you choose will depend on logic in sig_handler_constructor.
// 'man 7 signal' and 'man sigwait' are both helpful for making this
// decision. One way or another, all of the server's client threads
// should terminate on SIGINT. The server (this includes the listener
// thread) should not, however, terminate on SIGINT!
Code executed by the signal handler thread. For the purpose of this
assignment, there are two reasonable ways to implement this.
The one you choose will depend on logic in sig_handler_constructor.
'man 7 signal' and 'man sigwait' are both helpful for making this
decision. One way or another, all of the server's client threads
should terminate on SIGINT. The server (this includes the listener
thread) should not, however, terminate on SIGINT!
Code executed by the signal handler thread . For the purpose of this assignment there are two reasonable ways to implement this . The one you choose will depend on logic in sig_handler_constructor . ' man 7 signal ' and ' man sigwait ' are both helpful for making this decision . One way or another all of the server ' s client threads should terminate on SIGINT . The server ( this includes the listener thread ) should not however terminate on SIGINT!
void *monitor_signal(void *arg) {
    sig_handler_t *signal_handler = (sig_handler_t*)arg;
	signal_handler->thread = pthread_self();
    sigset_t set = signal_handler->set;
    int sig;
    sigwait(&set, &sig);
    delete_all();
    return NULL;
}
void * monitor_signal ( void * arg ) { sig_handler_t * signal_handler = ( sig_handler_t * ) arg ; signal_handler -> thread = pthread_self ( ) ; sigset_t set = signal_handler -> set ; int sig ; sigwait ( & set , & sig ) ; delete_all ( ) ; return NULL ; }
Code executed by the signal handler thread.
Code executed by the signal handler thread .
// TODO: Wait for a SIGINT to be sent to the server process and cancel // all client threads when one arrives. // program terminates with SIGINT