forked from mirror/go-sqlcipher
fixes race
This commit is contained in:
parent
6f8cd03789
commit
588cd3292b
12
sqlite3.go
12
sqlite3.go
|
@ -766,14 +766,18 @@ func (s *SQLiteStmt) query(ctx context.Context, args []namedValue) (driver.Rows,
|
||||||
done: make(chan struct{}),
|
done: make(chan struct{}),
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func(db *C.sqlite3) {
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
C.sqlite3_interrupt(s.c.db)
|
select {
|
||||||
rows.Close()
|
case <-rows.done:
|
||||||
|
default:
|
||||||
|
C.sqlite3_interrupt(s.c.db)
|
||||||
|
rows.Close()
|
||||||
|
}
|
||||||
case <-rows.done:
|
case <-rows.done:
|
||||||
}
|
}
|
||||||
}()
|
}(s.c.db)
|
||||||
|
|
||||||
return rows, nil
|
return rows, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue