summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorMasami Hiramatsu <mhiramat@redhat.com>2009-12-03 15:35:34 -0500
committerMasami Hiramatsu <mhiramat@redhat.com>2009-12-03 15:35:34 -0500
commit5cd2f827aa03091c7d1832c9734827d8caff732d (patch)
tree4b426beb61c91cbabacc2a4f4bb82e77a9ec8fa2 /runtime
parent4a0ae64c47b159d4dd0ea471f1f8044503843a7f (diff)
downloadsystemtap-steved-5cd2f827aa03091c7d1832c9734827d8caff732d.tar.gz
systemtap-steved-5cd2f827aa03091c7d1832c9734827d8caff732d.tar.xz
systemtap-steved-5cd2f827aa03091c7d1832c9734827d8caff732d.zip
PR11020: Check switch_file global flag inside inner loop for busy scripts
* runtime/staprun/relay.c (reader_thread): Check switch_file thread flags inside inner read-write loop. And clear the flags after switching file.
Diffstat (limited to 'runtime')
-rw-r--r--runtime/staprun/relay.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/runtime/staprun/relay.c b/runtime/staprun/relay.c
index 59d7ac9a..39a2f393 100644
--- a/runtime/staprun/relay.c
+++ b/runtime/staprun/relay.c
@@ -166,9 +166,9 @@ static void *reader_thread(void *data)
if (stop_threads)
break;
if (switch_file[cpu]) {
- switch_file[cpu] = 0;
if (switch_outfile(cpu, &fnum) < 0)
goto error_out;
+ switch_file[cpu] = 0;
wsize = 0;
}
} else {
@@ -179,9 +179,11 @@ static void *reader_thread(void *data)
while ((rc = read(relay_fd[cpu], buf, sizeof(buf))) > 0) {
/* Switching file */
- if (fsize_max && wsize + rc > fsize_max) {
+ if ((fsize_max && wsize + rc > fsize_max) ||
+ switch_file[cpu]) {
if (switch_outfile(cpu, &fnum) < 0)
goto error_out;
+ switch_file[cpu] = 0;
wsize = 0;
}
if (write(out_fd[cpu], buf, rc) != rc) {