Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "context.h"
- #include <setjmp.h>
- static jmp_buf buf;
- static int context_saved = 0;
- void save_context() {
- if (context_saved == 0) {
- context_saved = setjmp(buf);
- }
- }
- void restore_context() {
- if (context_saved != 0) {
- longjmp(buf, 1);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment