frostfs-http-gw/global/context.go
Pavel Korotkov a44551d42b Add connection pool implementation (part 2)
Signed-off-by: Pavel Korotkov <pavel@nspcc.ru>
2021-04-06 12:19:21 +03:00

20 lines
349 B
Go

package global
import (
"context"
"os/signal"
"sync"
"syscall"
)
var (
globalContext context.Context
globalContextOnce sync.Once
)
func Context() context.Context {
globalContextOnce.Do(func() {
globalContext, _ = signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM, syscall.SIGHUP)
})
return globalContext
}