File: suppressed_context.go

package info (click to toggle)
gitlab-shell 14.35.0%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 23,652 kB
  • sloc: ruby: 1,129; makefile: 583; sql: 391; sh: 384
file content (18 lines) | stat: -rw-r--r-- 591 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package helper

import (
	"context"
	"time"
)

// suppressedContext suppresses cancellation or expiration of the context.
type suppressedContext struct{ context.Context }

func (suppressedContext) Deadline() (deadline time.Time, ok bool) { return time.Time{}, false }

func (suppressedContext) Done() <-chan struct{} { return nil }

func (suppressedContext) Err() error { return nil }

// SuppressCancellation returns a context that suppresses cancellation or expiration of the parent context.
func SuppressCancellation(ctx context.Context) context.Context { return suppressedContext{ctx} }