From 8addf5b6f934345c89ff9ce6f1e6998e9c05ee26 Mon Sep 17 00:00:00 2001 From: Bruce Allen Date: Tue, 11 Jan 2005 02:38:15 +0000 Subject: [PATCH] install a larger buffer for stdout. This ensures that log information from different scheduler requests running in parallel don't collide in the log file and appear intermingled. Very useful when doing verbose debugging. svn path=/trunk/boinc/; revision=5069 --- sched/main.C | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sched/main.C b/sched/main.C index dd7fe9f18e..9f664ebba1 100644 --- a/sched/main.C +++ b/sched/main.C @@ -97,6 +97,7 @@ int main() { unsigned int counter=0; char* code_sign_key; bool project_stopped = false; + char *stderr_buffer; #ifndef _USING_FCGI_ get_log_path(path, "cgi.log"); @@ -106,6 +107,16 @@ int main() { send_message(buf, 3600); exit(0); } + // install a larger buffer for stderr. This ensures that + // log information from different scheduler requests running + // in parallel don't collide in the log file and appear + // intermingled. + // + if (!(stderr_buffer=(char *)malloc(32768)) || setvbuf(stderr, stderr_buffer, _IOFBF, 32768)) { + log_messages.printf(SCHED_MSG_LOG::CRITICAL, + "Unable to change stderr buffering preferences\n" + ); + } #endif srand(time(0)+getpid());