PageRenderTime 20ms CodeModel.GetById 11ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

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