From 228f699fabb9962c13e116e3b7e57c11b7c77b72 Mon Sep 17 00:00:00 2001 From: Alexandre Fiori Date: Fri, 21 Nov 2014 07:46:13 -0500 Subject: [PATCH] Fix for calling concurrent Date and sendError For some reason I used Lock instead of RLock for Date. That's wrong. --- db.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/db.go b/db.go index 5cefb42..5417e23 100644 --- a/db.go +++ b/db.go @@ -263,8 +263,8 @@ func (db *DB) renameFile(name string) error { // Date returns the UTC date the database file was last modified. // If no database file has been opened the behaviour of Date is undefined. func (db *DB) Date() time.Time { - db.mu.Lock() - defer db.mu.Unlock() + db.mu.RLock() + defer db.mu.RUnlock() return db.lastUpdated } @@ -287,8 +287,8 @@ func (db *DB) NotifyError() (errChan <-chan error) { } func (db *DB) sendError(err error) { - db.mu.Lock() - defer db.mu.Unlock() + db.mu.RLock() + defer db.mu.RUnlock() if db.closed { return }