mirror of
https://github.com/PeernetOfficial/core.git
synced 2026-07-16 18:37:51 +01:00
19 lines
276 B
Go
19 lines
276 B
Go
package udt
|
|
|
|
import (
|
|
"sync/atomic"
|
|
"time"
|
|
)
|
|
|
|
type atomicDuration struct {
|
|
val int64
|
|
}
|
|
|
|
func (s *atomicDuration) get() time.Duration {
|
|
return time.Duration(atomic.LoadInt64(&s.val))
|
|
}
|
|
|
|
func (s *atomicDuration) set(v time.Duration) {
|
|
atomic.StoreInt64(&s.val, int64(v))
|
|
}
|