- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 2,010 for ONCE (0.04 sec)
-
src/sync/once.go
// first time for this instance of [Once]. In other words, given // // var once Once // // if once.Do(f) is called multiple times, only the first call will invoke f, // even if f has a different value in each invocation. A new instance of // Once is required for each function to execute. // // Do is intended for initialization that must be run exactly once. Since f
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Jun 07 21:14:51 UTC 2024 - 2.5K bytes - Viewed (0) -
src/sync/oncefunc.go
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 ) // Construct the inner closure just once to reduce costs on the fast path. g := func() { defer func() { p = recover()
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/example_test.go
} func ExampleOnce() { var once sync.Once onceBody := func() { fmt.Println("Only once") } done := make(chan bool) for i := 0; i < 10; i++ { go func() { once.Do(onceBody) done <- true }() } for i := 0; i < 10; i++ { <-done } // Output: // Only once } // This example uses OnceValue to perform an "expensive" computation just once, // even when used concurrently.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Tue Apr 23 17:45:47 UTC 2024 - 2.2K bytes - Viewed (0) -
test/inline_sync.go
// the Lock fast path should be inlined mutex.Lock() // ERROR "inlining call to sync\.\(\*Mutex\)\.Lock" } var once *sync.Once func small7() { // ERROR "can inline small7" // the Do fast path should be inlined once.Do(small5) // ERROR "inlining call to sync\.\(\*Once\)\.Do" "inlining call to atomic\.\(\*Uint32\)\.Load" } var rwmutex *sync.RWMutex func small8() { // ERROR "can inline small8"
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Fri Oct 06 21:01:50 UTC 2023 - 1.6K bytes - Viewed (0) -
staging/src/k8s.io/apimachinery/pkg/util/strategicpatch/testing/openapi3.go
package testing import ( "os" "sync" "k8s.io/kube-openapi/pkg/spec3" ) type OpenAPIV3Getter struct { Path string once sync.Once bytes []byte openapiv3 spec3.OpenAPI } func (f *OpenAPIV3Getter) SchemaBytesOrDie() []byte { f.once.Do(func() { _, err := os.Stat(f.Path) if err != nil { panic(err) } spec, err := os.ReadFile(f.Path) if err != nil { panic(err)
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Tue Oct 31 16:45:45 UTC 2023 - 1.3K bytes - Viewed (0) -
staging/src/k8s.io/apiserver/pkg/endpoints/filterlatency/filterlatency_test.go
w := httptest.NewRecorder() wrapped.ServeHTTP(w, testRequest) if handlerCallCount != 1 { t.Errorf("expected the given handler to be invoked once, but was actually invoked %d times", handlerCallCount) } if actionCallCount != 1 { t.Errorf("expected the action callback to be invoked once, but was actually invoked %d times", actionCallCount) } if filterRecordGot == nil {
Registered: Sat Jun 15 01:39:40 UTC 2024 - Last Modified: Fri Jun 07 17:57:37 UTC 2024 - 7.1K bytes - Viewed (0) -
platforms/core-runtime/service-provider/src/main/java/org/gradle/internal/service/scopes/GradleModuleServices.java
*/ @ServiceScope(Scope.Global.class) public interface GradleModuleServices extends ServiceRegistrationProvider { /** * Called once per process, to register any globally scoped services. These services are reused across builds in the same process. * The services are closed when the process finishes. *
Registered: Wed Jun 12 18:38:38 UTC 2024 - Last Modified: Mon May 27 12:34:44 UTC 2024 - 5.3K bytes - Viewed (0) -
src/io/pipe.go
if err == nil { err = ErrClosedPipe } p.rerr.Store(err) p.once.Do(func() { close(p.done) }) return nil } func (p *pipe) write(b []byte) (n int, err error) { select { case <-p.done: return 0, p.writeCloseError() default: p.wrMu.Lock() defer p.wrMu.Unlock() } for once := true; once || len(b) > 0; once = false { select { case p.wrCh <- b: nw := <-p.rdCh b = b[nw:]
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Oct 18 19:34:35 UTC 2023 - 5.1K bytes - Viewed (0) -
src/crypto/x509/root.go
// // Do not remove or change the type signature. // See go.dev/issue/67401. // //go:linkname systemRoots var ( once sync.Once systemRootsMu sync.RWMutex systemRoots *CertPool systemRootsErr error fallbacksSet bool ) func systemRootsPool() *CertPool { once.Do(initSystemRoots) systemRootsMu.RLock() defer systemRootsMu.RUnlock() return systemRoots } func initSystemRoots() {
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed May 29 17:58:53 UTC 2024 - 2.3K bytes - Viewed (0) -
src/net/pipe.go
case isClosedChan(p.writeDeadline.wait()): return 0, os.ErrDeadlineExceeded } p.wrMu.Lock() // Ensure entirety of b is written together defer p.wrMu.Unlock() for once := true; once || len(b) > 0; once = false { select { case p.wrTx <- b: nw := <-p.wrRx b = b[nw:] n += nw case <-p.localDone: return n, io.ErrClosedPipe case <-p.remoteDone:
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Jan 10 03:29:50 UTC 2024 - 5.4K bytes - Viewed (0)