move out c/cpp/py
This commit is contained in:
21
cl/_testlibc/once/in.go
Normal file
21
cl/_testlibc/once/in.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"github.com/goplus/lib/c"
|
||||
"github.com/goplus/lib/c/pthread/sync"
|
||||
)
|
||||
|
||||
var once sync.Once = sync.OnceInit
|
||||
|
||||
func f() {
|
||||
once.Do(func() {
|
||||
c.Printf(c.Str("Do once\n"))
|
||||
})
|
||||
}
|
||||
|
||||
func main() {
|
||||
println(c.GoString(c.Str("sync.Once demo\n"), 9))
|
||||
println(c.GoString(c.Str("sync.Once demo\n")))
|
||||
f()
|
||||
f()
|
||||
}
|
||||
Reference in New Issue
Block a user