From b255bf826919a51ce1d68f75f0f35c63fde09155 Mon Sep 17 00:00:00 2001 From: "matthias.ringwald" Date: Fri, 24 Dec 2010 00:19:22 +0000 Subject: [PATCH] use CFRunLoopTimerContext for CFRunLoopTimerCreate --- src/run_loop_cocoa.m | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/run_loop_cocoa.m b/src/run_loop_cocoa.m index 1e9c6d117..b8f5a9cc9 100644 --- a/src/run_loop_cocoa.m +++ b/src/run_loop_cocoa.m @@ -101,14 +101,14 @@ int cocoa_remove_data_source(data_source_t *dataSource){ void cocoa_add_timer(timer_source_t * ts) { + // printf("cocoa_add_timer %x\n", (int) ts); CFTimeInterval fireDate = ((double)ts->timeout.tv_sec) + (((double)ts->timeout.tv_usec)/1000000.0); - CFRunLoopTimerRef timerRef = CFRunLoopTimerCreate (kCFAllocatorDefault,fireDate,0,0,0,theCFRunLoopTimerCallBack,(void*)ts); - + CFRunLoopTimerContext timerContext = {0, ts, NULL, NULL, NULL}; + CFRunLoopTimerRef timerRef = CFRunLoopTimerCreate (kCFAllocatorDefault,fireDate,0,0,0,theCFRunLoopTimerCallBack,&timerContext); + // hack: store CFRunLoopTimerRef in next pointer of linked_item ts->item.next = (void *)timerRef; - - // printf("cocoa_add_timer ref %x\n", (int) timerRef); - + CFRunLoopAddTimer(CFRunLoopGetCurrent(), timerRef, kCFRunLoopCommonModes); }