implement run_loop_remove for cocoa

This commit is contained in:
matthias.ringwald 2009-10-28 21:51:56 +00:00
parent bfea266536
commit c8164b0280
3 changed files with 6 additions and 8 deletions

View File

@ -1,9 +1,6 @@
/* new todo file for BTstack */
NEXT:
- try to have BTdaemon use 0% cpu time when idle, after disconnect
- implement cocoa_remove_data_source
- fix BTstack and/or WiiMote Demo crash when quitting app
- prepend all source files with 'new BSD' copyright header
== Release Version 0.1

View File

@ -24,7 +24,7 @@ typedef struct data_source {
typedef struct timer {
linked_item_t item;
struct timeval timeout; // <-- next timeout
void (*process)(struct timer *ts); // <-- do processing
void (*process)(struct timer *ts); // <-- do processing
} timer_t;
// init must be called before any other run_loop call

View File

@ -40,18 +40,19 @@ void cocoa_add_data_source(data_source_t *dataSource){
socketDataCallback,
&socketContext
);
// hack: store CFSocketRef in next pointer of linked_item
dataSource->item.next = (void *) socket;
// create run loop source and add to run loop
CFRunLoopSourceRef socketRunLoop = CFSocketCreateRunLoopSource ( kCFAllocatorDefault, socket, 0);
CFRunLoopAddSource( CFRunLoopGetCurrent(), socketRunLoop, kCFRunLoopDefaultMode);
}
int cocoa_remove_data_source(data_source_t *dataSource){
// not needed yet
fprintf(stderr, "WARNING: run_loop_remove_data_source not implemented yet!");
// warning never the less
CFRunLoopRemoveSource( CFRunLoopGetCurrent(), dataSource->item.next, kCFRunLoopCommonModes);
return 0;
}
void cocoa_add_timer(timer_t * ts){
// not needed yet
fprintf(stderr, "WARNING: run_loop_add_timer not implemented yet!");