/src/test/ftk_test.c

http://ftk.googlecode.com/ · C · 41 lines · 30 code · 11 blank · 0 comment · 0 complexity · 67a386224549e4b3f50ab57f096c4765 MD5 · raw file

  1. #include "ftk.h"
  2. Ret timeout_quit(void* user_data)
  3. {
  4. ftk_quit();
  5. printf("%s:%d\n", __func__, __LINE__);
  6. return RET_REMOVE;
  7. }
  8. Ret timeout_repeat(void* user_data)
  9. {
  10. printf("%s:%d\n", __func__, __LINE__);
  11. return RET_OK;
  12. }
  13. Ret idle(void* user_data)
  14. {
  15. printf("%s:%d\n", __func__, __LINE__);
  16. return RET_REMOVE;
  17. }
  18. int main(int argc, char* argv[])
  19. {
  20. FtkSource* source = NULL;
  21. ftk_init(argc, argv);
  22. source = ftk_source_idle_create(idle, NULL);
  23. ftk_main_loop_add_source(ftk_default_main_loop(), source);
  24. source = ftk_source_timer_create(1000, timeout_repeat, NULL);
  25. ftk_main_loop_add_source(ftk_default_main_loop(), source);
  26. source = ftk_source_timer_create(10000, timeout_quit, NULL);
  27. ftk_main_loop_add_source(ftk_default_main_loop(), source);
  28. ftk_run();
  29. return 0;
  30. }