From d5706f5094bf10829cc28f6a29ab857e63b95e3e Mon Sep 17 00:00:00 2001 From: martin-s Date: Sat, 16 Jun 2012 18:28:55 +0000 Subject: [PATCH] Add:Core:Make asynchonicity for saved commands optional git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@5142 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- navit/navit/command.c | 10 ++++++++-- navit/navit/command.h | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/navit/navit/command.c b/navit/navit/command.c index 1523b6f..84fb1f2 100644 --- a/navit/navit/command.c +++ b/navit/navit/command.c @@ -65,6 +65,7 @@ struct command_saved { struct command_saved_cb *cbs; // List of callbacks for this saved command struct callback *cb; // Callback that should be called when we re-evaluate int error; + int async; }; enum error { @@ -1016,6 +1017,10 @@ command_saved_evaluate_idle (struct command_saved *cs) static void command_saved_evaluate(struct command_saved *cs) { + if (!cs->async) { + command_saved_evaluate_idle(cs); + return; + } if (cs->idle_ev) { // We're already scheduled for reevaluation return; @@ -1127,8 +1132,8 @@ command_register_callbacks(struct command_saved *cs) return 1; } -struct command_saved -*command_saved_new(char *command, struct navit *navit, struct callback *cb) +struct command_saved * +command_saved_new(char *command, struct navit *navit, struct callback *cb, int async) { struct command_saved *ret; @@ -1138,6 +1143,7 @@ struct command_saved ret->navit.type = attr_navit; ret->cb = cb; ret->error = not_ready; + ret->async = async; if (!command_register_callbacks(ret)) { // We try this as an idle call again diff --git a/navit/navit/command.h b/navit/navit/command.h index 916071e..3ab8d54 100644 --- a/navit/navit/command.h +++ b/navit/navit/command.h @@ -50,7 +50,7 @@ void command_add_table(struct callback_list *cbl, struct command_table *table, i void command_saved_set_cb(struct command_saved *cs, struct callback *cb); int command_saved_get_int(struct command_saved *cs); int command_saved_error(struct command_saved *cs); -struct command_saved *command_saved_new(char *command, struct navit *navit, struct callback *cb); +struct command_saved *command_saved_new(char *command, struct navit *navit, struct callback *cb, int async); void command_saved_destroy(struct command_saved *cs); /* end of prototypes */ #ifdef __cplusplus -- 2.7.4