This commit is contained in:
Judah Caruso 2025-12-06 22:44:52 -07:00
parent 1e64e35ccb
commit 502b5dd65f
2 changed files with 3 additions and 2 deletions

View file

@ -58,7 +58,7 @@ func Run(nLanes int, fn func(lane Lane)) {
osthread.Start(func() { osthread.Start(func() {
s := new(state) s := new(state)
s.cond = sync.NewCond(&s.mtx) s.cond.L = &s.mtx
s.total = uint64(nLanes) s.total = uint64(nLanes)
var wg sync.WaitGroup var wg sync.WaitGroup
@ -82,7 +82,7 @@ func Run(nLanes int, fn func(lane Lane)) {
type state struct { type state struct {
mtx sync.Mutex mtx sync.Mutex
cond *sync.Cond cond sync.Cond
waiting atomic.Uint64 waiting atomic.Uint64
total uint64 total uint64
userdata sync.Map userdata sync.Map

1
xx.go
View file

@ -30,6 +30,7 @@ func Clone[T any](value *T) *T {
return Copy(new(T), value) return Copy(new(T), value)
} }
// BoolUint converts a boolean to an integer.
func BoolUint(b bool) uint { func BoolUint(b bool) uint {
return uint(*(*uint8)(unsafe.Pointer(&b))) return uint(*(*uint8)(unsafe.Pointer(&b)))
} }