From 6f2749a3ca9b233ffb8749ef9684f7f4d88cee7a Mon Sep 17 00:00:00 2001 From: Yasuhiro Matsumoto Date: Tue, 3 Jan 2017 22:25:02 +0900 Subject: [PATCH] fix race condition --- sqlite3.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sqlite3.go b/sqlite3.go index 64933f1..a11e990 100644 --- a/sqlite3.go +++ b/sqlite3.go @@ -808,13 +808,13 @@ func (s *SQLiteStmt) exec(ctx context.Context, args []namedValue) (driver.Result done := make(chan struct{}) defer close(done) - go func() { + go func(db *C.sqlite3) { select { case <-ctx.Done(): - C.sqlite3_interrupt(s.c.db) + C.sqlite3_interrupt(db) case <-done: } - }() + }(s.c.db) var rowid, changes C.longlong rv := C._sqlite3_step(s.s, &rowid, &changes)