minor additions
This commit is contained in:
parent
19effc40a6
commit
1a56df57f9
3 changed files with 20 additions and 0 deletions
12
assert.go
12
assert.go
|
|
@ -1 +1,13 @@
|
||||||
|
//go:build !XX_DISABLE_ASSERT
|
||||||
|
|
||||||
package xx
|
package xx
|
||||||
|
|
||||||
|
func Assert(cond bool) {
|
||||||
|
if !cond {
|
||||||
|
panic("assertion failed")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func Unreachable() {
|
||||||
|
panic("unreachable")
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1 +1,7 @@
|
||||||
|
//go:build XX_DISABLE_ASSERT
|
||||||
|
|
||||||
package xx
|
package xx
|
||||||
|
|
||||||
|
func Assert(cond bool) {}
|
||||||
|
|
||||||
|
func Unreachable() {}
|
||||||
|
|
|
||||||
|
|
@ -114,12 +114,14 @@ func (l Lane) Sync() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Store sends 'value' to all lanes.
|
// Store sends 'value' to all lanes.
|
||||||
|
//
|
||||||
// Store can be called concurrently.
|
// Store can be called concurrently.
|
||||||
func (l Lane) Store(key, value any) {
|
func (l Lane) Store(key, value any) {
|
||||||
l.state.userdata.Store(key, value)
|
l.state.userdata.Store(key, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load fetches a named value, returning nil if it does not exist.
|
// Load fetches a named value, returning nil if it does not exist.
|
||||||
|
//
|
||||||
// Load can be called concurrently.
|
// Load can be called concurrently.
|
||||||
func (l Lane) Load(key any) any {
|
func (l Lane) Load(key any) any {
|
||||||
v, ok := l.state.userdata.Load(key)
|
v, ok := l.state.userdata.Load(key)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue