cancellation.h 771 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * cancellation.h
  3. *
  4. * Asynchronously-cancellable function calls.
  5. *
  6. * Written & released by Keir Fraser <keir.xen@gmail.com>
  7. *
  8. * This is free and unencumbered software released into the public domain.
  9. * See the file COPYING for more details, or visit <http://unlicense.org>.
  10. */
  11. struct cancellation {
  12. uint32_t *sp;
  13. };
  14. #define cancellation_is_active(c) ((c)->sp != NULL)
  15. /* Execute fn() in a wrapped cancellable environment. */
  16. int call_cancellable_fn(struct cancellation *c, int (*fn)(void *), void *arg);
  17. /* From IRQ content: stop running fn() and immediately return -1. */
  18. void cancel_call(struct cancellation *c);
  19. /*
  20. * Local variables:
  21. * mode: C
  22. * c-file-style: "Linux"
  23. * c-basic-offset: 4
  24. * tab-width: 4
  25. * indent-tabs-mode: nil
  26. * End:
  27. */