mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 16:24:19 -04:00
15 lines
247 B
Go
15 lines
247 B
Go
|
|
package plugin
|
||
|
|
|
||
|
|
import "context"
|
||
|
|
|
||
|
|
// Done is a non-blocking function that returns true if the context has been canceled.
|
||
|
|
func Done(ctx context.Context) bool {
|
||
|
|
select {
|
||
|
|
case <-ctx.Done():
|
||
|
|
return true
|
||
|
|
default:
|
||
|
|
return false
|
||
|
|
}
|
||
|
|
return false
|
||
|
|
}
|