/src/backend/iphone/ftk_source_iphone.m

http://ftk.googlecode.com/ · Objective C · 52 lines · 43 code · 9 blank · 0 comment · 7 complexity · 646d2a1c6f64a9245314d413780237f3 MD5 · raw file

  1. #import "ftk_source_iphone.h"
  2. #import <UIKit/UIKit.h>
  3. static int ftk_source_iphone_get_fd(FtkSource* thiz)
  4. {
  5. return -1;
  6. }
  7. static int ftk_source_iphone_check(FtkSource* thiz)
  8. {
  9. return 0;
  10. }
  11. static Ret ftk_source_iphone_dispatch(FtkSource* thiz)
  12. {
  13. SInt32 rc;
  14. if(setjmp(*jump_env()) == 0)
  15. {
  16. do
  17. {
  18. rc = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, TRUE);
  19. }
  20. while(rc == kCFRunLoopRunHandledSource);
  21. usleep(20000);
  22. }
  23. }
  24. static void ftk_source_iphone_destroy(FtkSource* thiz)
  25. {
  26. if(thiz != NULL)
  27. {
  28. FTK_ZFREE(thiz, sizeof(thiz));
  29. }
  30. }
  31. FtkSource* ftk_source_iphone_create(void)
  32. {
  33. FtkSource* thiz = (FtkSource*)FTK_ZALLOC(sizeof(FtkSource));
  34. if(thiz != NULL)
  35. {
  36. thiz->get_fd = ftk_source_iphone_get_fd;
  37. thiz->check = ftk_source_iphone_check;
  38. thiz->dispatch = ftk_source_iphone_dispatch;
  39. thiz->destroy = ftk_source_iphone_destroy;
  40. thiz->ref = 1;
  41. }
  42. return thiz;
  43. }