[chore]: Bump codeberg.org/gruf/go-mutexes from 1.5.1 to 1.5.2 (#3976)

Bumps codeberg.org/gruf/go-mutexes from 1.5.1 to 1.5.2.

---
updated-dependencies:
- dependency-name: codeberg.org/gruf/go-mutexes
  dependency-version: 1.5.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
dependabot[bot] 2025-04-07 11:04:45 +01:00 committed by GitHub
parent 2cc5d6269d
commit 4232d61782
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 47 additions and 30 deletions

2
go.mod
View file

@ -23,7 +23,7 @@ require (
codeberg.org/gruf/go-kv v1.6.5
codeberg.org/gruf/go-list v0.0.0-20240425093752-494db03d641f
codeberg.org/gruf/go-mempool v0.0.0-20240507125005-cef10d64a760
codeberg.org/gruf/go-mutexes v1.5.1
codeberg.org/gruf/go-mutexes v1.5.2
codeberg.org/gruf/go-runners v1.6.3
codeberg.org/gruf/go-sched v1.2.4
codeberg.org/gruf/go-storage v0.2.0

4
go.sum generated
View file

@ -30,8 +30,8 @@ codeberg.org/gruf/go-maps v1.0.4 h1:K+Ww4vvR3TZqm5jqrKVirmguZwa3v1VUvmig2SE8uxY=
codeberg.org/gruf/go-maps v1.0.4/go.mod h1:ASX7osM7kFwt5O8GfGflcFjrwYGD8eIuRLl/oMjhEi8=
codeberg.org/gruf/go-mempool v0.0.0-20240507125005-cef10d64a760 h1:m2/UCRXhjDwAg4vyji6iKCpomKw6P4PmBOUi5DvAMH4=
codeberg.org/gruf/go-mempool v0.0.0-20240507125005-cef10d64a760/go.mod h1:E3RcaCFNq4zXpvaJb8lfpPqdUAmSkP5F1VmMiEUYTEk=
codeberg.org/gruf/go-mutexes v1.5.1 h1:xICU0WXhWr6wf+Iror4eE3xT+xnXNPrO6o77D/G6QuY=
codeberg.org/gruf/go-mutexes v1.5.1/go.mod h1:rPEqQ/y6CmGITaZ3GPTMQVsoZAOzbsAHyIaLsJcOqVE=
codeberg.org/gruf/go-mutexes v1.5.2 h1:rp2o774ApGUVtOHDksqtBiqIcvniVfgFWSazszDluy0=
codeberg.org/gruf/go-mutexes v1.5.2/go.mod h1:AnhagsMzUISL/nBVwhnHwDwTZOAxMILwCOG8/wKOblg=
codeberg.org/gruf/go-runners v1.6.3 h1:To/AX7eTrWuXrTkA3RA01YTP5zha1VZ68LQ+0D4RY7E=
codeberg.org/gruf/go-runners v1.6.3/go.mod h1:oXAaUmG2VxoKttpCqZGv5nQBeSvZSR2BzIk7h1yTRlU=
codeberg.org/gruf/go-sched v1.2.4 h1:ddBB9o0D/2oU8NbQ0ldN5aWxogpXPRBATWi58+p++Hw=

View file

@ -2,7 +2,6 @@ package mutexes
import (
"sync"
"sync/atomic"
"unsafe"
"codeberg.org/gruf/go-mempool"
@ -185,34 +184,11 @@ func (mu *rwmutex) Unlock() bool {
// Fully unlocked.
mu.t = 0
// NOTE: must remain in
// sync with runtime.notifyList{}.
//
// goexperiment.staticlockranking
// does change it slightly, but
// this does not alter the first
// 2 fields which are all we need.
type notifyList struct {
_ uint32
notify uint32
// ... other fields
}
// NOTE: must remain in
// sync with sync.Cond{}.
type syncCond struct {
_ struct{}
L sync.Locker
n notifyList
// ... other fields
}
// Awake all blocked goroutines and check
// for change in the last notified ticket.
cptr := (*syncCond)(unsafe.Pointer(&mu.c))
before := atomic.LoadUint32(&cptr.n.notify)
before := syncCond_last_ticket(&mu.c)
mu.c.Broadcast() // awakes all blocked!
after := atomic.LoadUint32(&cptr.n.notify)
after := syncCond_last_ticket(&mu.c)
// If ticket changed, this indicates
// AT LEAST one goroutine was awoken.

41
vendor/codeberg.org/gruf/go-mutexes/map_unsafe.go generated vendored Normal file
View file

@ -0,0 +1,41 @@
//go:build go1.22 && !go1.25
package mutexes
import (
"sync"
"sync/atomic"
"unsafe"
)
// syncCond_last_ticket is an unsafe function that returns
// the ticket of the last awoken / notified goroutine by a
// a sync.Cond{}. it relies on expected memory layout.
func syncCond_last_ticket(c *sync.Cond) uint32 {
// NOTE: must remain in
// sync with runtime.notifyList{}.
//
// goexperiment.staticlockranking
// does change it slightly, but
// this does not alter the first
// 2 fields which are all we need.
type notifyList struct {
_ atomic.Uint32
notify uint32
// ... other fields
}
// NOTE: must remain in
// sync with sync.Cond{}.
type syncCond struct {
_ struct{}
L sync.Locker
n notifyList
// ... other fields
}
// This field must be atomcially accessed.
cptr := (*syncCond)(unsafe.Pointer(c))
return atomic.LoadUint32(&cptr.n.notify)
}

2
vendor/modules.txt vendored
View file

@ -47,7 +47,7 @@ codeberg.org/gruf/go-maps
# codeberg.org/gruf/go-mempool v0.0.0-20240507125005-cef10d64a760
## explicit; go 1.22.2
codeberg.org/gruf/go-mempool
# codeberg.org/gruf/go-mutexes v1.5.1
# codeberg.org/gruf/go-mutexes v1.5.2
## explicit; go 1.22.2
codeberg.org/gruf/go-mutexes
# codeberg.org/gruf/go-runners v1.6.3