Ingo Molnar | 34ef216 | 2013-09-30 16:46:49 +0200 | [diff] [blame] | 1 | #include <stdio.h> |
2 | |||||
Ingo Molnar | 1e3f30f | 2013-10-02 15:48:49 +0200 | [diff] [blame^] | 3 | static void exit_fn(int status, void *__data) |
4 | { | ||||
5 | printf("exit status: %d, data: %d\n", status, *(int *)__data); | ||||
6 | } | ||||
7 | |||||
8 | static int data = 123; | ||||
9 | |||||
Ingo Molnar | 34ef216 | 2013-09-30 16:46:49 +0200 | [diff] [blame] | 10 | int main(void) |
11 | { | ||||
Ingo Molnar | 1e3f30f | 2013-10-02 15:48:49 +0200 | [diff] [blame^] | 12 | on_exit(exit_fn, &data); |
13 | |||||
14 | return 321; | ||||
Ingo Molnar | 34ef216 | 2013-09-30 16:46:49 +0200 | [diff] [blame] | 15 | } |