ADTast-experimentalenumforall-pointer-decaypthread-emulationqualifiedEnum
Last change
on this file since d0b9247 was
bf71cfd,
checked in by Thierry Delisle <tdelisle@…>, 6 years ago
|
Moved up many directories in source
|
-
Property mode set to
100644
|
File size:
788 bytes
|
Line | |
---|
1 | #include <pthread.h> |
---|
2 | #include <stdlib.h> |
---|
3 | #include <signal.h> |
---|
4 | |
---|
5 | #define __CFA_SIGCXT__ ucontext_t * |
---|
6 | #define __CFA_SIGPARMS__ __attribute__((unused)) int sig, __attribute__((unused)) siginfo_t *sfp, __attribute__((unused)) __CFA_SIGCXT__ cxt |
---|
7 | |
---|
8 | void sigHandler( __CFA_SIGPARMS__ ) { |
---|
9 | sigset_t mask; |
---|
10 | sigemptyset( &mask ); |
---|
11 | sigaddset( &mask, SIGUSR1 ); |
---|
12 | |
---|
13 | if ( sigprocmask( SIG_UNBLOCK, &mask, NULL ) == -1 ) { |
---|
14 | abort(); |
---|
15 | } // if |
---|
16 | } |
---|
17 | |
---|
18 | int main() { |
---|
19 | |
---|
20 | struct sigaction act; |
---|
21 | |
---|
22 | act.sa_sigaction = (void (*)(int, siginfo_t *, void *))sigHandler; |
---|
23 | sigemptyset( &act.sa_mask ); |
---|
24 | sigaddset( &act.sa_mask, SIGUSR1 ); |
---|
25 | |
---|
26 | act.sa_flags = SA_SIGINFO; |
---|
27 | |
---|
28 | if ( sigaction( SIGUSR1, &act, NULL ) == -1 ) { |
---|
29 | abort(); |
---|
30 | } // if |
---|
31 | |
---|
32 | for( int i = 0; i < 50000000ul; i++ ) { |
---|
33 | pthread_kill( pthread_self(), SIGUSR1 ); |
---|
34 | } |
---|
35 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.