setjmp


1. Error Handling

int main() {
  jmp_buf env;
  if (setjmp(env) != 0) {
    // An error occurred, handle it
    return 1;
  }

  // Do something that might throw an error

  return 0;
}

2. Non-Local Return

int func1() {
  jmp_buf env;
  setjmp(env);
  return 1;  // This return will jump back to the caller of func1
}

int main() {
  int ret = func1();
  printf("func1 returned %d\n", ret);
  return 0;
}

3. Fork with Longjmp

4. Signal Handling

5. Thread Creation

6. Exception Handling

7. Coroutines

8. Asynchronous Programming

9. Timeouts

10. State Machines

11. Emulated Threads

12. Context-Switching

13. Co-Routines with Go Style

14. Exception Unwinding

15. Error Recovery

16. Non-Local GoTo

17. Task Management

18. Event-Driven Programming

19. Dynamic Control Flow

20. Recursive Descent Parsing

21. Emulated Exceptions

22. Cooperative Multi-Tasking

23. Error Handling in Multi-Threaded Applications

24. Dynamic Code Execution

25. Memory Protection

26. Deadlock Recovery

27. Error Propagation

28. Lightweight Threading

29. Thread Synchronization

30. Failure Injection

31. Rollback Transactions

32. Lazy Evaluation

33. Profiling