⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 p7-3.c

📁 SUN Solaris8平台下进程间通信
💻 C
字号:
#include <sys/types.h>#include <signal.h>#include <stdio.h>#include <time.h>#include <unistd.h>#include <sys/times.h>volatile int gotit = 0;void alarm_handler(int signal){    gotit = 1;    puts("catch alarm");}int main(int argc, char ** argv){  clock_t  start, stop;  struct tms buffer;  signal(SIGALRM, alarm_handler);  /* 设置信号句柄 */  start = times(&buffer);  alarm(1);  while (!gotit);        /* 等待定时器到时 */  stop = times(&buffer);  printf ("%ld clock ticks per second (start=%ld,stop=%ld)\n",      stop - start, start, stop);  printf ("sysconf(_SC_CLK_TCK)=%ld\n",      sysconf(_SC_CLK_TCK));  return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -