Пример #1
0
static void stop_sighandler(int signum)
{
    do_deactivate_getch2();

    // note: for this signal, we use SA_RESETHAND but do NOT mask signals
    // so this will invoke the default handler
    raise(SIGTSTP);
}
Пример #2
0
void getch2_poll(void){
    if (!getch2_enabled)
        return;

    // check if stdin is in the foreground process group
    int newstatus = (tcgetpgrp(0) == getpgrp());

    // and activate getch2 if it is, deactivate otherwise
    if (newstatus)
        do_activate_getch2();
    else
        do_deactivate_getch2();
}
Пример #3
0
void getch2_disable(void){
    if (!getch2_enabled)
        return;

    // restore signals
    setsigaction(SIGCONT, SIG_DFL, 0, false);
    setsigaction(SIGTSTP, SIG_DFL, 0, false);
    setsigaction(SIGINT, SIG_DFL, 0, false);
    setsigaction(SIGTTIN, SIG_DFL, 0, false);

    do_deactivate_getch2();

    getch2_enabled = 0;
}
Пример #4
0
static void quit_request_sighandler(int signum)
{
    do_deactivate_getch2();

    async_quit_request = 1;
}