当前位置: 首页 > news >正文

网站用图要怎么做做电影网站需要多大空间

网站用图要怎么做,做电影网站需要多大空间,网站经营内容,网站动态图怎么做在 Linux C 应用编程中#xff0c;对于多线程编程中的定时器函数使用#xff0c;通常可以借助 pthread 库和系统提供的定时器相关的函数来实现。 首先#xff0c;常见的定时器函数有 setitimer() 和 alarm() 。setitimer() 函数可以更精确地设置定时器#xff0c;它可以设…在 Linux C 应用编程中对于多线程编程中的定时器函数使用通常可以借助 pthread 库和系统提供的定时器相关的函数来实现。 首先常见的定时器函数有 setitimer() 和 alarm() 。setitimer() 函数可以更精确地设置定时器它可以设置为 ITIMER_REAL以实时时间递减、ITIMER_VIRTUAL以进程在用户态执行的时间递减和 ITIMER_PROF以进程在用户态和内核态执行的时间递减三种模式。 #include stdio.h #include stdlib.h #include pthread.h #include unistd.h #include signal.h #include time.h#define TIMER_INTERVAL_SEC 2void timer_handler(union sigval sv) {printf(Timer expired. Thread ID: %ld\n, pthread_self()); }void* thread_function(void* arg) {timer_t timer_id;struct sigevent sev;sev.sigev_notify SIGEV_THREAD;sev.sigev_notify_function timer_handler;sev.sigev_value.sival_ptr timer_id;timer_create(CLOCK_REALTIME, sev, timer_id);struct itimerspec its;its.it_interval.tv_sec TIMER_INTERVAL_SEC;its.it_interval.tv_nsec 0;its.it_value.tv_sec 1;its.it_value.tv_nsec 0;timer_settime(timer_id, 0, its, NULL);while (1) {sleep(1);}timer_delete(timer_id);pthread_exit(NULL); }int main() {pthread_t thread_id1, thread_id2;pthread_create(thread_id1, NULL, thread_function, NULL);pthread_create(thread_id2, NULL, thread_function, NULL);pthread_join(thread_id1, NULL);pthread_join(thread_id2, NULL);return 0; } #include stdio.h #include time.h #include signal.h #include unistd.h #include stdlib.h#define TIMER_SIG SIGRTMINvoid timer_handler(int sig, siginfo_t *si, void *uc) {// 定时器到期时被调用的处理函数printf(Timer fired!\n); }int main() {timer_t timerid;struct sigevent sev;struct itimerspec its;struct sigaction sa;// 设置处理函数sa.sa_flags SA_SIGINFO;sa.sa_sigaction timer_handler;sigemptyset(sa.sa_mask);if (sigaction(TIMER_SIG, sa, NULL) -1) {perror(sigaction);exit(1);}// 创建定时器sev.sigev_notify SIGEV_SIGNAL;sev.sigev_signo TIMER_SIG;sev.sigev_value.sival_ptr timerid;if (timer_create(CLOCK_REALTIME, sev, timerid) -1) {perror(timer_create);exit(1);}// 启动定时器its.it_value.tv_sec 2; // 初次到期时间2秒后its.it_value.tv_nsec 0;its.it_interval.tv_sec 1; // 定时器周期每隔1秒its.it_interval.tv_nsec 0;if (timer_settime(timerid, 0, its, NULL) -1) {perror(timer_settime);exit(1);}sleep(10); // 等待定时器触发几次return 0; }
http://www.dnsts.com.cn/news/213016.html

相关文章:

  • 自己做热图的网站做公司网站的总结
  • 互联网网站运营wordpress注册跳过邮箱验证码
  • 魔方网站网易企业邮箱忘记密码
  • 校园网站建设的要素vi应用设计
  • 杭州市临安区建设局网站吴江区网站建设
  • 手机端网站怎么做关于网站建设的大学
  • 网站建设一般要素生鲜超市营销策划方案
  • 高端移动网站开发雅安市网站建设
  • 网站链接数岳阳网约车
  • 门户网站建设jz190做配电箱的专门网站
  • 网站域名改了帝国cms微信上怎么做网站
  • 网站开发模块化开发17网站一起做网店不发货
  • 网站建设二级分销将page转换为wordpress
  • jsp做网站用到的软件网页设计图片怎么变小
  • 备案网站建设书传奇网页游戏网
  • 北京市中交建设有限公司网站网站外链怎么看
  • 程序员 做网站 微信公众号 赚钱中卫网站推广外包服务
  • 哪些公司的网站做的漂亮网络会议系统有哪些
  • 上海专业做网站电话263企业邮箱后缀是什么
  • 如何降低网站相似度请描述网站开发的一般流程图
  • 做网站卖什么条件手机app设计软件
  • 网站 添加备案号cms wordpress 区别
  • 郑州网站建设出名吗郑州网站建设白杨网络
  • 查看网站信息图标怎么做徐州网站建设开发
  • 如何做查询网站wordpress响应免费主题
  • 安徽智能网站建设免费网站建设哪家好
  • 可以做网站的行业网站建设注册教程
  • 网站开发可选择的方案有深圳分销网站制作
  • 网站规划与网页设计案例做网站内嵌地图
  • c2c网站程序多少钱摄像头监控设备企业网站模板