timerapi.cpp 539 B

1234567891011121314151617181920212223242526272829303132
  1. #include "api.h"
  2. #include "timerapi.h"
  3. #include "tmultiplex.h"
  4. //timer_api *timerApi = NULL;
  5. TimerApi::TimerApi()
  6. {
  7. }
  8. TimerApi::~TimerApi()
  9. {
  10. multiplex.shutdown();
  11. }
  12. TimerToken TimerApi::timer_add(TimerClient *client, intptr_t id, int ms)
  13. {
  14. multiplex.add(client, id, ms);
  15. return id;
  16. }
  17. void TimerApi::timer_remove(TimerClient *client, TimerToken id)
  18. {
  19. multiplex.remove(client, id);
  20. }
  21. #define CBCLASS TimerApi
  22. START_DISPATCH;
  23. CB(TIMER_API_ADD, timer_add);
  24. VCB(TIMER_API_REMOVE, timer_remove);
  25. END_DISPATCH;
  26. #undef CBCLASS