Add:Core:Make asynchonicity for saved commands optional
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sat, 16 Jun 2012 18:28:55 +0000 (18:28 +0000)
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>
Sat, 16 Jun 2012 18:28:55 +0000 (18:28 +0000)
git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@5142 ffa7fe5e-494d-0410-b361-a75ebd5db220

navit/navit/command.c
navit/navit/command.h

index 1523b6f..84fb1f2 100644 (file)
@@ -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
index 916071e..3ab8d54 100644 (file)
@@ -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