source: code/trunk/vendor/nhooyr.io/websocket/internal/xsync/int64.go@ 822

Last change on this file since 822 was 822, checked in by yakumo.izuru, 22 months ago

Prefer immortal.run over runit and rc.d, use vendored modules
for convenience.

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

File size: 408 bytes
Line 
1package xsync
2
3import (
4 "sync/atomic"
5)
6
7// Int64 represents an atomic int64.
8type Int64 struct {
9 // We do not use atomic.Load/StoreInt64 since it does not
10 // work on 32 bit computers but we need 64 bit integers.
11 i atomic.Value
12}
13
14// Load loads the int64.
15func (v *Int64) Load() int64 {
16 i, _ := v.i.Load().(int64)
17 return i
18}
19
20// Store stores the int64.
21func (v *Int64) Store(i int64) {
22 v.i.Store(i)
23}
Note: See TracBrowser for help on using the repository browser.