pause

package module
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2022 License: MIT Imports: 2 Imported by: 4

README

Build Status Coverage Report Go Reference

pause

Package pause implements a method which suspends execution until its given Context is done or it's waited its given timeout.

Usage

package main

import (
	"context"
	"fmt"
	"time"

	"github.com/azazeal/pause"
)

func main() {
	pause.For(context.TODO(), time.Second)
	fmt.Println("about a second elapsed since we called pause.For")

	ctx, cancel := context.WithCancel(context.TODO())
	cancel()
	pause.For(ctx, time.Hour)
	fmt.Println("almost no time elapsed since we called pause.For")
}

Documentation

Overview

Package pause implements a method which suspends execution until its given Context is done or it's waited the given timeout.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func For

func For(ctx context.Context, timeout time.Duration)

For suspends execution until ctx is done or it's waited the given timeout.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL