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_test.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_test import ( . "sync" "testing" ) type one int func (o *one) Increment() { *o++ } func run(t *testing.T, once *Once, o *one, c chan bool) { once.Do(func() { o.Increment() }) if v := *o; v != 1 { t.Errorf("once failed inside run: %d is not 1", v) } c <- true } func TestOnce(t *testing.T) { o := new(one) once := new(Once) c := make(chan bool) const N = 10 for i := 0; i < N; i++ { go run(t, once, o, c) } for i := 0; i < N; i++ { <-c } if *o != 1 { t.Errorf("once failed outside run: %d is not 1", *o) } } func TestOncePanic(t *testing.T) { var once Once func() { defer func() { if r := recover(); r == nil { t.Fatalf("Once.Do did not panic") } }() once.Do(func() { panic("failed") }) }() once.Do(func() { t.Fatalf("Once.Do called twice") }) } func BenchmarkOnce(b *testing.B) { var once Once f := func() {} b.RunParallel(func(pb *testing.PB) { for pb.Next() { once.Do(f) } }) }
Close