We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
master
ART-Pi Smart Board
GCC
Compile the following code snippet and run the program in userspace:
#include <stdio.h> #include <unistd.h> #include <signal.h> #include <stdlib.h> int main() { // 信号集合 sigset_t set; int sig; // 初始化信号集合 sigemptyset(&set); sigaddset(&set, SIGALRM); // 阻塞 SIGALRM 信号,确保 sigwait 可以捕获到该信号 if (sigprocmask(SIG_BLOCK, &set, NULL) == -1) { perror("sigprocmask"); exit(EXIT_FAILURE); } // 设置闹钟,3 秒后触发 SIGALRM 信号 alarm(3); // 等待 SIGALRM 信号 printf("Waiting for the alarm...\n"); if (sigwait(&set, &sig) == 0) { printf("Alarm triggered! Signal number: %d\n", sig); } else { perror("sigwait"); exit(EXIT_FAILURE); } // 收到信号后继续执行 printf("Program continues after alarm.\n"); return 0; }
No response
The text was updated successfully, but these errors were encountered:
No branches or pull requests
RT-Thread Version
master
Hardware Type/Architectures
ART-Pi Smart Board
Develop Toolchain
GCC
Describe the bug
Compile the following code snippet and run the program in userspace:
Other additional context
No response
The text was updated successfully, but these errors were encountered: