callbacks.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #define DEFINE_CALLBACK(WATCHER_LC, WATCHER_TYPE) \
  2. static void gevent_callback_##WATCHER_LC(struct ev_loop *, void *, int);
  3. #define DEFINE_CALLBACKS0 \
  4. DEFINE_CALLBACK(io, IO); \
  5. DEFINE_CALLBACK(timer, Timer); \
  6. DEFINE_CALLBACK(signal, Signal); \
  7. DEFINE_CALLBACK(idle, Idle); \
  8. DEFINE_CALLBACK(prepare, Prepare); \
  9. DEFINE_CALLBACK(check, Check); \
  10. DEFINE_CALLBACK(fork, Fork); \
  11. DEFINE_CALLBACK(async, Async); \
  12. DEFINE_CALLBACK(stat, Stat);
  13. #ifndef _WIN32
  14. #define DEFINE_CALLBACKS \
  15. DEFINE_CALLBACKS0 \
  16. DEFINE_CALLBACK(child, Child)
  17. #else
  18. #define DEFINE_CALLBACKS DEFINE_CALLBACKS0
  19. #endif
  20. DEFINE_CALLBACKS
  21. static void gevent_run_callbacks(struct ev_loop *, void *, int);
  22. struct PyGeventLoopObject;
  23. static void gevent_handle_error(struct PyGeventLoopObject* loop, PyObject* context);
  24. struct PyGeventCallbackObject;
  25. static void gevent_call(struct PyGeventLoopObject* loop, struct PyGeventCallbackObject* cb);
  26. #if defined(_WIN32)
  27. static void gevent_periodic_signal_check(struct ev_loop *, void *, int);
  28. #endif
  29. static void gevent_noop(struct ev_loop *_loop, void *watcher, int revents) { }