mirror of
https://github.com/status-im/status-go.git
synced 2025-01-10 22:56:40 +00:00
14 lines
243 B
Go
14 lines
243 B
Go
package common
|
|
|
|
import "context"
|
|
|
|
// ShouldCancel returns true if the context has been cancelled and task should be aborted
|
|
func ShouldCancel(ctx context.Context) bool {
|
|
select {
|
|
case <-ctx.Done():
|
|
return true
|
|
default:
|
|
}
|
|
return false
|
|
}
|