summaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authorMark Spencer <markster@digium.com>2003-05-12 04:23:55 +0000
committerMark Spencer <markster@digium.com>2003-05-12 04:23:55 +0000
commit40c4e1f8c4fadec1a59fac6ed28b35461f804b0e (patch)
treeea489daf4f7d64dce260b9e4c59e413de180437a /file.c
parent21524d66529806cfdb0dc056ff5628becfc8d7c5 (diff)
Use zaptel timers to wake up processes
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1002 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'file.c')
-rwxr-xr-xfile.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/file.c b/file.c
index 466b8aa5a..4ad7fa974 100755
--- a/file.c
+++ b/file.c
@@ -615,12 +615,13 @@ char ast_waitstream(struct ast_channel *c, char *breakon)
ast_closestream(c->stream);
break;
}
+ /* Setup timeout if supported */
+ ast_settimeout(c, res);
res = ast_waitfor(c, res);
if (res < 0) {
ast_log(LOG_WARNING, "Select failed (%s)\n", strerror(errno));
return res;
- } else
- if (res > 0) {
+ } else if (res > 0) {
fr = ast_read(c);
if (!fr) {
#if 0
@@ -652,8 +653,8 @@ char ast_waitstream(struct ast_channel *c, char *breakon)
}
/* Ignore */
ast_frfree(fr);
- } else
- ast_sched_runq(c->sched);
+ }
+ ast_sched_runq(c->sched);
}
@@ -670,6 +671,7 @@ char ast_waitstream_fr(struct ast_channel *c, char *breakon, char *forward, char
ast_closestream(c->stream);
break;
}
+ ast_settimeout(c, res);
res = ast_waitfor(c, res);
if (res < 0) {
ast_log(LOG_WARNING, "Select failed (%s)\n", strerror(errno));
@@ -733,6 +735,7 @@ char ast_waitstream_full(struct ast_channel *c, char *breakon, int audiofd, int
ast_closestream(c->stream);
break;
}
+ ast_settimeout(c, ms);
rchan = ast_waitfor_nandfds(&c, 1, &cmdfd, (cmdfd > -1) ? 1 : 0, NULL, &outfd, &ms);
if (!rchan && (outfd < 0) && (ms)) {
ast_log(LOG_WARNING, "Wait failed (%s)\n", strerror(errno));
@@ -776,8 +779,8 @@ char ast_waitstream_full(struct ast_channel *c, char *breakon, int audiofd, int
}
/* Ignore */
ast_frfree(fr);
- } else
- ast_sched_runq(c->sched);
+ }
+ ast_sched_runq(c->sched);
}