Source File
closer.go
Belonging Package
github.com/pion/dtls/v3/internal/closer
// SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>// SPDX-License-Identifier: MIT// Package closer provides signaling channel for shutdownpackage closerimport ()// Closer allows for each signaling a channel for shutdown.type Closer struct {ctx context.Context //nolint:containedctxcloseFunc func()}// NewCloser creates a new instance of Closer.func () *Closer {, := context.WithCancel(context.Background())return &Closer{ctx: ,closeFunc: ,}}// NewCloserWithParent creates a new instance of Closer with a parent context.func ( context.Context) *Closer {, := context.WithCancel()return &Closer{ctx: ,closeFunc: ,}}// Done returns a channel signaling when it is done.func ( *Closer) () <-chan struct{} {return .ctx.Done()}// Err returns an error of the context.func ( *Closer) () error {return .ctx.Err()}// Close sends a signal to trigger the ctx done channel.func ( *Closer) () {.closeFunc()}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |