run_loop: only warn if add/remove data source is not implemented

This commit is contained in:
Matthias Ringwald 2016-01-06 21:06:52 +01:00
parent 7a33c82fe7
commit 3e671d0e7d
2 changed files with 13 additions and 19 deletions

View File

@ -64,21 +64,6 @@ static wiced_queue_t run_loop_queue;
// the run loop // the run loop
static bk_linked_list_t timers; static bk_linked_list_t timers;
/**
* Add data_source to run_loop
*/
static void run_loop_wiced_add_data_source(data_source_t *ds){
log_error("run_loop_add_data_source not supported in run_loop_wiced");
}
/**
* Remove data_source from run loop
*/
static int run_loop_wiced_remove_data_source(data_source_t *ds){
log_error("run_loop_add_data_source not supported in run_loop_wiced");
return 0;
}
static uint32_t run_loop_wiced_get_time_ms(void){ static uint32_t run_loop_wiced_get_time_ms(void){
wiced_time_t time; wiced_time_t time;
wiced_time_get_time(&time); wiced_time_get_time(&time);
@ -182,8 +167,8 @@ const run_loop_t * run_loop_wiced_get_instance(void){
static const run_loop_t run_loop_wiced = { static const run_loop_t run_loop_wiced = {
&run_loop_wiced_run_loop_init, &run_loop_wiced_run_loop_init,
&run_loop_wiced_add_data_source, NULL,
&run_loop_wiced_remove_data_source, NULL,
&run_loop_wiced_set_timer, &run_loop_wiced_set_timer,
&run_loop_wiced_add_timer, &run_loop_wiced_add_timer,
&run_loop_wiced_remove_timer, &run_loop_wiced_remove_timer,

View File

@ -82,7 +82,11 @@ void run_loop_set_data_source_handler(data_source_t *ds, int (*process)(data_sou
*/ */
void run_loop_add_data_source(data_source_t *ds){ void run_loop_add_data_source(data_source_t *ds){
run_loop_assert(); run_loop_assert();
the_run_loop->add_data_source(ds); if (the_run_loop->add_data_source){
the_run_loop->add_data_source(ds);
} else {
log_error("run_loop_add_data_source not implemented");
}
} }
/** /**
@ -90,7 +94,12 @@ void run_loop_add_data_source(data_source_t *ds){
*/ */
int run_loop_remove_data_source(data_source_t *ds){ int run_loop_remove_data_source(data_source_t *ds){
run_loop_assert(); run_loop_assert();
return the_run_loop->remove_data_source(ds); if (the_run_loop->remove_data_source){
return the_run_loop->remove_data_source(ds);
} else {
log_error("run_loop_remove_data_source not implemented");
return 0;
}
} }
void run_loop_set_timer(timer_source_t *a, uint32_t timeout_in_ms){ void run_loop_set_timer(timer_source_t *a, uint32_t timeout_in_ms){