mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-16 16:58:35 +00:00
add optional trailing & to sched_api to denote running the task in a sep thread
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14765 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
7d3753a039
commit
105f5d4396
@ -2491,14 +2491,15 @@ SWITCH_STANDARD_API(unsched_api_function)
|
|||||||
return SWITCH_STATUS_SUCCESS;
|
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)
|
SWITCH_STANDARD_API(sched_api_function)
|
||||||
{
|
{
|
||||||
char *tm = NULL, *dcmd, *group;
|
char *tm = NULL, *dcmd, *group;
|
||||||
time_t when;
|
time_t when;
|
||||||
struct api_task *api_task = NULL;
|
struct api_task *api_task = NULL;
|
||||||
uint32_t recur = 0;
|
uint32_t recur = 0;
|
||||||
|
int flags = SSHF_FREE_ARG;
|
||||||
|
|
||||||
if (!cmd) {
|
if (!cmd) {
|
||||||
goto bad;
|
goto bad;
|
||||||
}
|
}
|
||||||
@ -2525,8 +2526,13 @@ SWITCH_STANDARD_API(sched_api_function)
|
|||||||
switch_zmalloc(api_task, sizeof(*api_task) + strlen(dcmd) + 1);
|
switch_zmalloc(api_task, sizeof(*api_task) + strlen(dcmd) + 1);
|
||||||
switch_copy_string(api_task->cmd, dcmd, strlen(dcmd) + 1);
|
switch_copy_string(api_task->cmd, dcmd, strlen(dcmd) + 1);
|
||||||
api_task->recur = recur;
|
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);
|
stream->write_function(stream, "+OK Added: %u\n", id);
|
||||||
goto good;
|
goto good;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user