完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
#include #include <time.h> #include #include #include #include #include #include void m_sa_sigaction(int i, siginfo_t *siginfo, void * v) { printf("do something @ heren"); } int main(int argc, char *argv[]) { clockid_t clockid = CLOCK_MONOTONIC; int signum = SIGUSR1; struct sigevent sevp = { .sigev_notify = SIGEV_SIGNAL, /* Notification method */ /*Notify the process by sending the signal specified in sigev_signo.*/ .sigev_signo = signum, /* Notification signal */ .sigev_value.sival_int = 0, /* Data passed with notification */ }; timer_t timerid; struct itimerspec new_value = { .it_interval = { .tv_sec = 1, .tv_nsec = 0, }, /* Timer interval */ .it_value = { .tv_sec = 0, .tv_nsec = 1, }, /* Initial expiration */ }; struct sigaction act = { .sa_sigaction = m_sa_sigaction, .sa_flags = SA_SIGINFO, }; sigemptyset(&act.sa_mask); if(sigaction(signum, &act, NULL) == -1){ perror("sigaction"); } if(timer_create(clockid, &sevp, &timerid) == -1){ perror("timer_createn"); } if(timer_settime(timerid, 0, &new_value, NULL) == -1){ perror("timer_settimen"); } while(1) { sleep(1); fprintf(stderr, "#"); } } |
|
相关推荐
|
|
飞凌嵌入式ElfBoard ELF 1板卡-mfgtools烧录流程之烧写方法
473 浏览 0 评论
飞凌嵌入式ElfBoard ELF 1板卡-内核编译之初次编译
700 浏览 0 评论
飞凌嵌入式ElfBoard ELF 1板卡-内核源代码的目录结构和文件说明
623 浏览 0 评论
飞凌嵌入式ElfBoard ELF 1板卡-Linux内核移植之内核简介
1222 浏览 0 评论
非科班也能玩转Android应用,体验QT跨平台能力-迅为RK3568开发板
1081 浏览 0 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-20 09:07 , Processed in 0.449957 second(s), Total 36, Slave 29 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号