EventBase_pvt.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /* vim: set expandtab ts=4 sw=4: */
  2. /*
  3. * You may redistribute this program and/or modify it under the terms of
  4. * the GNU General Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. *
  7. * This program is distributed in the hope that it will be useful,
  8. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. * GNU General Public License for more details.
  11. *
  12. * You should have received a copy of the GNU General Public License
  13. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  14. */
  15. #ifndef EventBase_pvt_H
  16. #define EventBase_pvt_H
  17. #include "rust/cjdns_sys/Rffi.h"
  18. #include "memory/Allocator.h"
  19. #include "util/events/EventBase.h"
  20. #include "util/Identity.h"
  21. #include "util/events/libuv/UvWrapper.h"
  22. struct EventBase_pvt
  23. {
  24. struct EventBase pub;
  25. uv_loop_t* loop;
  26. Rffi_EventLoop* rffi_loop;
  27. // Wake up the loop if something comes from the rust/tokio side
  28. uv_async_t uvAwakener;
  29. uv_timer_t blockTimer;
  30. // This allocator is parent of all the event listeners registered with this loop
  31. // It is freed only when the loop has no more events registered
  32. struct Allocator* alloc;
  33. // This allocator comes from the user who creates the loop
  34. struct Allocator* userAlloc;
  35. /** True if the loop is running. */
  36. int running;
  37. /** Number of milliseconds since epoch when the clock was calibrated. */
  38. uint64_t baseTime;
  39. void* timeouts;
  40. Identity
  41. };
  42. struct EventBase_pvt* EventBase_privatize(struct EventBase* base);
  43. #endif