mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-30 16:20:24 +00:00
implement run_loop_remove for cocoa
This commit is contained in:
parent
bfea266536
commit
c8164b0280
3
TODO.txt
3
TODO.txt
@ -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
|
||||
|
@ -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
|
||||
|
@ -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!");
|
||||
|
Loading…
x
Reference in New Issue
Block a user