make sure realtime/high scheduling priority is relinquished before executing an AGI script (issue #4930)

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@6368 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2005-08-23 01:30:22 +00:00
parent dde23d5d0f
commit 2cde73fddb
3 changed files with 7 additions and 2 deletions

View File

@@ -674,7 +674,7 @@ static void set_icon(char *text)
fprintf(stdout, "\033]1;%s\007", text); fprintf(stdout, "\033]1;%s\007", text);
} }
static int set_priority(int pri) int ast_set_priority(int pri)
{ {
struct sched_param sched; struct sched_param sched;
memset(&sched, 0, sizeof(sched)); memset(&sched, 0, sizeof(sched));
@@ -1940,7 +1940,7 @@ int main(int argc, char *argv[])
ast_verbose("[ Reading Master Configuration ]"); ast_verbose("[ Reading Master Configuration ]");
ast_readconfig(); ast_readconfig();
if (set_priority(option_highpriority)) { if (ast_set_priority(option_highpriority)) {
exit(1); exit(1);
} }

View File

@@ -37,6 +37,8 @@ extern char ast_config_AST_CTL_OWNER[AST_CONFIG_MAX_PATH];
extern char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH]; extern char ast_config_AST_CTL_GROUP[AST_CONFIG_MAX_PATH];
extern char ast_config_AST_CTL[AST_CONFIG_MAX_PATH]; extern char ast_config_AST_CTL[AST_CONFIG_MAX_PATH];
/* Provided by asterisk.c */
extern int ast_set_priority(int);
/* Provided by module.c */ /* Provided by module.c */
extern int load_modules(const int preload_only); extern int load_modules(const int preload_only);
/* Provided by pbx.c */ /* Provided by pbx.c */

View File

@@ -279,6 +279,9 @@ static int launch_script(char *script, char *argv[], int *fds, int *efd, int *op
for (x=STDERR_FILENO + 2;x<1024;x++) for (x=STDERR_FILENO + 2;x<1024;x++)
close(x); close(x);
/* Don't run AGI scripts with realtime priority -- it causes audio stutter */
ast_set_priority(0);
/* Execute script */ /* Execute script */
execv(script, argv); execv(script, argv);
/* Can't use ast_log since FD's are closed */ /* Can't use ast_log since FD's are closed */