mirror of
https://github.com/go-gitea/gitea
synced 2025-07-23 10:48:37 +00:00
Update caddyserver/certmagic (#16789)
Fixes issue with windows users & letsencrypt Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
34
vendor/go.uber.org/atomic/float64_ext.go
generated
vendored
34
vendor/go.uber.org/atomic/float64_ext.go
generated
vendored
@@ -20,15 +20,18 @@
|
||||
|
||||
package atomic
|
||||
|
||||
import "strconv"
|
||||
import (
|
||||
"math"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
//go:generate bin/gen-atomicwrapper -name=Float64 -type=float64 -wrapped=Uint64 -pack=math.Float64bits -unpack=math.Float64frombits -cas -json -imports math -file=float64.go
|
||||
//go:generate bin/gen-atomicwrapper -name=Float64 -type=float64 -wrapped=Uint64 -pack=math.Float64bits -unpack=math.Float64frombits -swap -json -imports math -file=float64.go
|
||||
|
||||
// Add atomically adds to the wrapped float64 and returns the new value.
|
||||
func (f *Float64) Add(s float64) float64 {
|
||||
func (f *Float64) Add(delta float64) float64 {
|
||||
for {
|
||||
old := f.Load()
|
||||
new := old + s
|
||||
new := old + delta
|
||||
if f.CAS(old, new) {
|
||||
return new
|
||||
}
|
||||
@@ -36,8 +39,27 @@ func (f *Float64) Add(s float64) float64 {
|
||||
}
|
||||
|
||||
// Sub atomically subtracts from the wrapped float64 and returns the new value.
|
||||
func (f *Float64) Sub(s float64) float64 {
|
||||
return f.Add(-s)
|
||||
func (f *Float64) Sub(delta float64) float64 {
|
||||
return f.Add(-delta)
|
||||
}
|
||||
|
||||
// CAS is an atomic compare-and-swap for float64 values.
|
||||
//
|
||||
// Note: CAS handles NaN incorrectly. NaN != NaN using Go's inbuilt operators
|
||||
// but CAS allows a stored NaN to compare equal to a passed in NaN.
|
||||
// This avoids typical CAS loops from blocking forever, e.g.,
|
||||
//
|
||||
// for {
|
||||
// old := atom.Load()
|
||||
// new = f(old)
|
||||
// if atom.CAS(old, new) {
|
||||
// break
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// If CAS did not match NaN to match, then the above would loop forever.
|
||||
func (f *Float64) CAS(old, new float64) (swapped bool) {
|
||||
return f.v.CAS(math.Float64bits(old), math.Float64bits(new))
|
||||
}
|
||||
|
||||
// String encodes the wrapped value as a string.
|
||||
|
Reference in New Issue
Block a user