📄 mqnotifythread1.c.sun
字号:
#include "unpipc.h"struct sigevent sigev;mqd_t mqd;#if defined(sun) && defined(__svr4__)#define sigev_notify_function _sigev_un._sigev_notify_function#define sigev_notify_attributes _sigev_notify_attributes#endifstatic void notify_thread(union sigval); /* our thread function */intmain(int argc, char **argv){ if (argc != 2) err_quit("usage: mqnotify2 <name>"); mqd = Mq_open(argv[1], O_RDONLY); sigev.sigev_notify = SIGEV_THREAD; sigev.sigev_value.sival_ptr = NULL; sigev.sigev_notify_function = notify_thread; sigev.sigev_notify_attributes = NULL; Mq_notify(mqd, &sigev); for ( ; ; ) pause(); exit(0);}static voidnotify_thread(union sigval arg){ printf("notify_thread started\n"); Mq_notify(mqd, &sigev); /* reregister */ pthread_exit(NULL);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -