Linux 120.141.167.72.host.secureserver.net 4.18.0-553.150.1.el8_10.x86_64 #1 SMP Fri Jul 31 15:23:31 EDT 2026 x86_64
Apache
: 72.167.141.120 | : 216.73.217.14
808 Domain
7.4.33
bestseocompany
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
README
+ Create Folder
+ Create File
/
usr /
local /
go /
src /
sync /
[ HOME SHELL ]
Name
Size
Permission
Action
atomic
[ DIR ]
drwxr-xr-x
cond.go
4.05
KB
-rw-r--r--
cond_test.go
4.96
KB
-rw-r--r--
example_pool_test.go
1017
B
-rw-r--r--
example_test.go
2.18
KB
-rw-r--r--
export_test.go
1.24
KB
-rw-r--r--
map.go
15.59
KB
-rw-r--r--
map_bench_test.go
11.47
KB
-rw-r--r--
map_reference_test.go
5.61
KB
-rw-r--r--
map_test.go
8.07
KB
-rw-r--r--
mutex.go
8.35
KB
-rw-r--r--
mutex_test.go
5.94
KB
-rw-r--r--
once.go
2.46
KB
-rw-r--r--
once_test.go
1.1
KB
-rw-r--r--
oncefunc.go
2
KB
-rw-r--r--
oncefunc_test.go
6.94
KB
-rw-r--r--
pool.go
9.39
KB
-rw-r--r--
pool_test.go
8.05
KB
-rw-r--r--
poolqueue.go
8.33
KB
-rw-r--r--
runtime.go
2.33
KB
-rw-r--r--
runtime2.go
465
B
-rw-r--r--
runtime2_lockrank.go
546
B
-rw-r--r--
runtime_sema_test.go
1.34
KB
-rw-r--r--
rwmutex.go
7.19
KB
-rw-r--r--
rwmutex_test.go
4.89
KB
-rw-r--r--
waitgroup.go
3.99
KB
-rw-r--r--
waitgroup_test.go
3.01
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : once.go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package sync import ( "sync/atomic" ) // Once is an object that will perform exactly one action. // // A Once must not be copied after first use. // // In the terminology of [the Go memory model], // the return from f “synchronizes before” // the return from any call of once.Do(f). // // [the Go memory model]: https://go.dev/ref/mem type Once struct { // done indicates whether the action has been performed. // It is first in the struct because it is used in the hot path. // The hot path is inlined at every call site. // Placing done first allows more compact instructions on some architectures (amd64/386), // and fewer instructions (to calculate offset) on other architectures. done atomic.Uint32 m Mutex } // Do calls the function f if and only if Do is being called for the // 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 // is niladic, it may be necessary to use a function literal to capture the // arguments to a function to be invoked by Do: // // config.once.Do(func() { config.init(filename) }) // // Because no call to Do returns until the one call to f returns, if f causes // Do to be called, it will deadlock. // // If f panics, Do considers it to have returned; future calls of Do return // without calling f. func (o *Once) Do(f func()) { // Note: Here is an incorrect implementation of Do: // // if o.done.CompareAndSwap(0, 1) { // f() // } // // Do guarantees that when it returns, f has finished. // This implementation would not implement that guarantee: // given two simultaneous calls, the winner of the cas would // call f, and the second would return immediately, without // waiting for the first's call to f to complete. // This is why the slow path falls back to a mutex, and why // the o.done.Store must be delayed until after f returns. if o.done.Load() == 0 { // Outlined slow-path to allow inlining of the fast-path. o.doSlow(f) } } func (o *Once) doSlow(f func()) { o.m.Lock() defer o.m.Unlock() if o.done.Load() == 0 { defer o.done.Store(1) f() } }
Close