]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add optional trailing & to sched_api to denote running the task in a sep thread
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 4 Sep 2009 15:48:00 +0000 (15:48 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 4 Sep 2009 15:48:00 +0000 (15:48 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14765 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_commands/mod_commands.c

index e998c2ee8680652ce2a3b23827adda30f93b0652..8cb9276e78c025518dce6f5def2f302d2830864a 100644 (file)
@@ -2491,14 +2491,15 @@ SWITCH_STANDARD_API(unsched_api_function)
        return SWITCH_STATUS_SUCCESS;
 }
 
-#define SCHED_SYNTAX "[+@]<time> <group_name> <command_string>"
+#define SCHED_SYNTAX "[+@]<time> <group_name> <command_string>[&]"
 SWITCH_STANDARD_API(sched_api_function)
 {
        char *tm = NULL, *dcmd, *group;
        time_t when;
        struct api_task *api_task = NULL;
        uint32_t recur = 0;
-       
+       int flags = SSHF_FREE_ARG;
+
        if (!cmd) {
                goto bad;
        }
@@ -2525,8 +2526,13 @@ SWITCH_STANDARD_API(sched_api_function)
                        switch_zmalloc(api_task, sizeof(*api_task) + strlen(dcmd) + 1);
                        switch_copy_string(api_task->cmd, dcmd, strlen(dcmd) + 1);
                        api_task->recur = recur;
+                       if (end_of(api_task->cmd) == '&') {
+                               end_of(api_task->cmd) = '\0';
+                               flags |= SSHF_OWN_THREAD;
+                       }
+
 
-                       id = switch_scheduler_add_task(when, sch_api_callback, (char *) __SWITCH_FUNC__, group, 0, api_task, SSHF_FREE_ARG);
+                       id = switch_scheduler_add_task(when, sch_api_callback, (char *) __SWITCH_FUNC__, group, 0, api_task, flags);
                        stream->write_function(stream, "+OK Added: %u\n", id);
                        goto good;
                }