From fb1bcd47c6c172d93d2ed1f320baf49d96a88975 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 9 Oct 2009 16:45:20 -0700 Subject: [PATCH] acid bug fix. lock printf output to avoid interlacing debug prints. R=r DELTA=10 (7 added, 0 deleted, 3 changed) OCL=35539 CL=35561 --- src/pkg/runtime/print.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/pkg/runtime/print.c b/src/pkg/runtime/print.c index c9929cd454..fb2881be55 100644 --- a/src/pkg/runtime/print.c +++ b/src/pkg/runtime/print.c @@ -4,6 +4,7 @@ #include "runtime.h" +static Lock debuglock; void dump(byte *p, int32 n) @@ -36,6 +37,8 @@ printf(int8 *s, ...) int8 *p, *lp; byte *arg, *narg; + lock(&debuglock); + lp = p = s; arg = (byte*)(&s+1); for(; *p; p++) { @@ -96,6 +99,8 @@ printf(int8 *s, ...) } if(p > lp) write(1, lp, p-lp); + + unlock(&debuglock); } -- 2.48.1