(ctx context.Context)
| 53 | } |
| 54 | |
| 55 | func (g *sqliteWriteGate) Lock(ctx context.Context) error { |
| 56 | select { |
| 57 | case g.ch <- struct{}{}: |
| 58 | return nil |
| 59 | default: |
| 60 | } |
| 61 | if ctx == nil { |
| 62 | ctx = context.Background() |
| 63 | } |
| 64 | select { |
| 65 | case g.ch <- struct{}{}: |
| 66 | return nil |
| 67 | case <-ctx.Done(): |
| 68 | return ctx.Err() |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | func (g *sqliteWriteGate) Unlock() { |
| 73 | select { |
no outgoing calls