Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for ExampleWithDeadline (0.19 sec)

  1. src/context/example_test.go

    	// Output:
    	// 1
    	// 2
    	// 3
    	// 4
    	// 5
    }
    
    // This example passes a context with an arbitrary deadline to tell a blocking
    // function that it should abandon its work as soon as it gets to it.
    func ExampleWithDeadline() {
    	d := time.Now().Add(shortDuration)
    	ctx, cancel := context.WithDeadline(context.Background(), d)
    
    	// Even though ctx will be expired, it is good practice to call its
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 21 20:24:28 UTC 2023
    - 6.7K bytes
    - Viewed (0)
Back to top