void cide(struct kill_list *klp) { int pidi, rc; if (klp->sigval == SIG_KILL) for (pidi = 0; klp->pid[pidi] && pidi < MAXPID; pidi++) if ( (rc = DosKillProcess(1, klp->pid[pidi])) ) { printf("kill: DosKillProcess(1, %d) failed. rc = %d\n", klp->pid[pidi], rc); return; } else printf("KillProcess sent to process %d\n", klp->pid[pidi]); #ifdef I16 else if (klp->sigval == SIG_PFLG_A || klp->sigval == SIG_PFLG_B || klp->sigval == SIG_PFLG_C) for (pidi = 0; klp->pid[pidi] && pidi < MAXPID; pidi++) if ((rc=DosFlagProcess(klp->pid[pidi],1,klp->sigval-SIG_PFLG_A,0))) { printf("kill: DosFlagProcess(%d, 1, %d, 0) failed. rc = %d\n", klp->pid[pidi], rc); return; } else printf("User flag %c sent to process %d\n", 'A' + klp->sigval - SIG_PFLG_A, klp->pid[pidi]); #endif }
static VOID FAR alarm_thread ( VOID ) { while(1) { if (bAlarmRunning) { DosSleep(1000L); uTime--; if (uTime==0L) { // send signal to the main process.. I could have put raise() here // however that would require the use of the multithreaded library, // and it does not contain raise()! // I tried it with the standard library, this signaled ok, but a // test printf in the signal would not work and even caused SEGV. // So I signal the process through OS/2 and then the process // signals itself. if (bAlarmRunning) DosFlagProcess(pidMain,FLGP_PID, PFLG_A,1); bAlarmRunning=FALSE; } } else DosSleep(500L); } }