Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for OnceFunc (0.19 sec)

  1. src/sync/oncefunc.go

    // Use of this source code is governed by a BSD-style
    // license that can be found in the LICENSE file.
    
    package sync
    
    // OnceFunc returns a function that invokes f only once. The returned function
    // may be called concurrently.
    //
    // If f panics, the returned function will panic with the same value on every call.
    func OnceFunc(f func()) func() {
    	var (
    		once  Once
    		valid bool
    		p     any
    	)
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 21 17:31:33 UTC 2023
    - 2K bytes
    - Viewed (0)
  2. src/sync/oncefunc_test.go

    			// never mutated and is a closure that could be inlined.
    			// Too bad, because this is how OnceFunc will usually be used.
    			onceFunc()
    		}
    	})
    	b.Run("v=Local", func(b *testing.B) {
    		b.ReportAllocs()
    		// As of 3/2023, the compiler *does* recognize this local binding as an
    		// inlinable closure. This is the best case for OnceFunc, but probably
    		// not typical usage.
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Nov 21 17:31:33 UTC 2023
    - 6.9K bytes
    - Viewed (0)
  3. src/cmd/compile/internal/test/inl_test.go

    			"(*rngSource).Int63",
    			"(*rngSource).Uint64",
    		},
    		"net": {
    			"(*UDPConn).ReadFromUDP",
    		},
    		"sync": {
    			// Both OnceFunc and its returned closure need to be inlinable so
    			// that the returned closure can be inlined into the caller of OnceFunc.
    			"OnceFunc",
    			"OnceFunc.func2", // The returned closure.
    			// TODO(austin): It would be good to check OnceValue and OnceValues,
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 09 04:07:57 UTC 2024
    - 10.7K bytes
    - Viewed (0)
  4. src/internal/syscall/windows/version_windows.go

    	return info.majorVersion, info.minorVersion, info.buildNumber
    }
    
    var (
    	supportTCPKeepAliveIdle     bool
    	supportTCPKeepAliveInterval bool
    	supportTCPKeepAliveCount    bool
    )
    
    var initTCPKeepAlive = sync.OnceFunc(func() {
    	s, err := WSASocket(syscall.AF_INET, syscall.SOCK_STREAM, syscall.IPPROTO_TCP, nil, 0, WSA_FLAG_NO_HANDLE_INHERIT)
    	if err != nil {
    		// Fallback to checking the Windows version.
    		major, _, build := version()
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Mar 21 11:49:46 UTC 2024
    - 3.6K bytes
    - Viewed (0)
  5. api/go1.21.txt

    pkg slices, func SortStableFunc[$0 interface{ ~[]$1 }, $1 interface{}]($0, func($1, $1) int) #60091
    pkg strings, func ContainsFunc(string, func(int32) bool) bool #54386
    pkg sync, func OnceFunc(func()) func() #56102
    pkg sync, func OnceValue[$0 interface{}](func() $0) func() $0 #56102
    pkg sync, func OnceValues[$0 interface{}, $1 interface{}](func() ($0, $1)) func() ($0, $1) #56102
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Aug 07 09:39:17 UTC 2023
    - 25.6K bytes
    - Viewed (0)
  6. src/internal/poll/fd_windows.go

    }
    
    // InitWSA initiates the use of the Winsock DLL by the current process.
    // It is called from the net package at init time to avoid
    // loading ws2_32.dll when net is not used.
    var InitWSA = sync.OnceFunc(func() {
    	var d syscall.WSAData
    	e := syscall.WSAStartup(uint32(0x202), &d)
    	if e != nil {
    		initErr = e
    	}
    	checkSetFileCompletionNotificationModes()
    })
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Wed Jan 31 16:50:42 UTC 2024
    - 34.1K bytes
    - Viewed (0)
  7. src/cmd/vendor/golang.org/x/tools/internal/stdlib/manifest.go

    		{"(*WaitGroup).Wait", Method, 0},
    		{"Cond", Type, 0},
    		{"Cond.L", Field, 0},
    		{"Locker", Type, 0},
    		{"Map", Type, 9},
    		{"Mutex", Type, 0},
    		{"NewCond", Func, 0},
    		{"Once", Type, 0},
    		{"OnceFunc", Func, 21},
    		{"OnceValue", Func, 21},
    		{"OnceValues", Func, 21},
    		{"Pool", Type, 3},
    		{"Pool.New", Field, 3},
    		{"RWMutex", Type, 0},
    		{"WaitGroup", Type, 0},
    	},
    	"sync/atomic": {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Apr 02 02:20:05 UTC 2024
    - 534.2K bytes
    - Viewed (0)
Back to top