From c70665750231151e8e0dc4a854fb7d5421bb4855 Mon Sep 17 00:00:00 2001 From: Stephen J Day Date: Wed, 26 Nov 2014 15:33:33 -0800 Subject: [PATCH] Address race condition in client tests (closes #784) --- client/objectstore.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/objectstore.go b/client/objectstore.go index 814cdbab..06fba3d8 100644 --- a/client/objectstore.go +++ b/client/objectstore.go @@ -211,6 +211,13 @@ func (mlw *memoryLayerWriter) Write(p []byte) (int, error) { } func (mlw *memoryLayerWriter) Close() error { + mlw.ml.cond.L.Lock() + defer mlw.ml.cond.L.Unlock() + + return mlw.close() +} + +func (mlw *memoryLayerWriter) close() error { mlw.ml.writing = false mlw.ml.cond.Broadcast() return nil