Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 1 of 1 for ExampleWithCancel (0.12 sec)

  1. src/context/example_test.go

    // This example demonstrates the use of a cancelable context to prevent a
    // goroutine leak. By the end of the example function, the goroutine started
    // by gen will return without leaking.
    func ExampleWithCancel() {
    	// gen generates integers in a separate goroutine and
    	// sends them to the returned channel.
    	// The callers of gen need to cancel the context once
    	// they are done consuming generated integers not to leak
    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