int main(void) { printf("before\n"); sleep1(5); printf("after\n"); return 0; }
int main(int argc, char *argv[]) { printf("start...\n"); sleep1(5); printf("end...\n"); return 0; }
int main(int argc, char const *argv[]) { unsigned int unslep; if (signal(SIGINT,sig_int)==SIG_ERR) { /* code */printf("err sig int\n"); } unslep = sleep1(5); printf("sleep1 return %u\n",unslep ); return 0; }
int test_sleep1() { int ret; time_t beg, end; signal(SIGINT, sleep1_sig_interrupt); beg = time(NULL); ret = sleep1(8); printf("sleep left time is %d\n", ret); end = time(NULL); printf("duration %d\n", end - beg); return 0; }
int main(void){ alarm(5); printf("main sleep1 before\n"); sleep1(3); printf("main sleep1 after\n"); }