| 15 | int32_t cleanup_state = 1; |
| 16 | |
| 17 | static void cleanup_handler1(void *arg) { |
| 18 | cleanup_state <<= 2; |
| 19 | // Perform non-commutative arithmetic to a global var that encodes the cleanup stack order ops. |
| 20 | cleanup_state *= (intptr_t)arg; |
| 21 | printf("Called clean-up handler 1 with arg %p (state=%d)\n", arg, cleanup_state); |
| 22 | } |
| 23 | |
| 24 | static void cleanup_handler2(void *arg) { |
| 25 | cleanup_state <<= 3; |