MCPcopy
hub / github.com/jackc/pgx / Unwatch

Method Unwatch

pgconn/ctxwatch/context_watcher.go:51–63  ·  view source on GitHub ↗

Unwatch stops watching the previously watched context. If the onCancel function passed to NewContextWatcher was called then onUnwatchAfterCancel will also be called.

()

Source from the content-addressed store, hash-verified

49// Unwatch stops watching the previously watched context. If the onCancel function passed to NewContextWatcher was
50// called then onUnwatchAfterCancel will also be called.
51func (cw *ContextWatcher) Unwatch() {
52 cw.lock.Lock()
53 defer cw.lock.Unlock()
54
55 if cw.stop != nil {
56 if !cw.stop() {
57 <-cw.done
58 cw.handler.HandleUnwatchAfterCancel()
59 }
60 cw.stop = nil
61 cw.done = nil
62 }
63}
64
65type Handler interface {
66 // HandleCancel is called when the context that a ContextWatcher is currently watching is canceled. canceledCtx is the

Calls 1