fix race condition

This commit is contained in:
Yasuhiro Matsumoto 2017-01-03 22:25:02 +09:00
parent 2d44decb49
commit 6f2749a3ca
1 changed files with 3 additions and 3 deletions

View File

@ -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)