-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtatomic64.c
More file actions
42 lines (35 loc) · 692 Bytes
/
Copy pathtatomic64.c
File metadata and controls
42 lines (35 loc) · 692 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
int main(void);
void catch_signal(int);
#ifdef USE_VOLATILE
extern volatile
#else
extern
#endif
uint64_t x;
int
main()
{
(void) signal(SIGUSR1, catch_signal);
while (1) {
/* may evaluate to true if x is modified by ISR */
if (!(x == x)) {
puts("X does not equal X!");
}
/* may also evaluate to true if x is modified by ISR */
if (x-x) {
puts("X-X does not equal 0!");
}
}
exit(0);
}
/*
* Local Variables:
* eval: (make-local-variable 'compile-command)
* compile-command: "make tatomic64 OPTIM=-O3 CFLAGS+=-DUSE_VOLATILE LDLIBS=tatomic64-sigusr.c"
* End:
*/