- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for OnceFunc (0.1 sec)
-
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) -
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) -
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)