[chore]: Bump codeberg.org/gruf/go-mutexes from 1.3.1 to 1.4.0 (#2562)
Bumps codeberg.org/gruf/go-mutexes from 1.3.1 to 1.4.0. --- updated-dependencies: - dependency-name: codeberg.org/gruf/go-mutexes dependency-type: direct:production update-type: version-update:semver-minor ... 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:
parent
9d80f7fd68
commit
b3ba1516a7
2
go.mod
2
go.mod
|
@ -14,7 +14,7 @@ require (
|
||||||
codeberg.org/gruf/go-iotools v0.0.0-20230811115124-5d4223615a7f
|
codeberg.org/gruf/go-iotools v0.0.0-20230811115124-5d4223615a7f
|
||||||
codeberg.org/gruf/go-kv v1.6.4
|
codeberg.org/gruf/go-kv v1.6.4
|
||||||
codeberg.org/gruf/go-logger/v2 v2.2.1
|
codeberg.org/gruf/go-logger/v2 v2.2.1
|
||||||
codeberg.org/gruf/go-mutexes v1.3.1
|
codeberg.org/gruf/go-mutexes v1.4.0
|
||||||
codeberg.org/gruf/go-runners v1.6.2
|
codeberg.org/gruf/go-runners v1.6.2
|
||||||
codeberg.org/gruf/go-sched v1.2.3
|
codeberg.org/gruf/go-sched v1.2.3
|
||||||
codeberg.org/gruf/go-store/v2 v2.2.4
|
codeberg.org/gruf/go-store/v2 v2.2.4
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -62,8 +62,8 @@ codeberg.org/gruf/go-mangler v1.2.3 h1:sj0dey2lF5GRQL7fXmCY0wPNaI5JrROiThb0VDbzF
|
||||||
codeberg.org/gruf/go-mangler v1.2.3/go.mod h1:X/7URkFhLBAVKkTxmqF11Oxw3A6pSSxgPeHssQaiq28=
|
codeberg.org/gruf/go-mangler v1.2.3/go.mod h1:X/7URkFhLBAVKkTxmqF11Oxw3A6pSSxgPeHssQaiq28=
|
||||||
codeberg.org/gruf/go-maps v1.0.3 h1:VDwhnnaVNUIy5O93CvkcE2IZXnMB1+IJjzfop9V12es=
|
codeberg.org/gruf/go-maps v1.0.3 h1:VDwhnnaVNUIy5O93CvkcE2IZXnMB1+IJjzfop9V12es=
|
||||||
codeberg.org/gruf/go-maps v1.0.3/go.mod h1:D5LNDxlC9rsDuVQVM6JObaVGAdHB6g2dTdOdkh1aXWA=
|
codeberg.org/gruf/go-maps v1.0.3/go.mod h1:D5LNDxlC9rsDuVQVM6JObaVGAdHB6g2dTdOdkh1aXWA=
|
||||||
codeberg.org/gruf/go-mutexes v1.3.1 h1:8ibAjWwx08GJSq5R+lM9nwtJw2aAhMPKSXbfJ9EpDsA=
|
codeberg.org/gruf/go-mutexes v1.4.0 h1:53H6bFDRcG6rjk3iOTuGaStT/VTFdU5Uw8Dszy88a8g=
|
||||||
codeberg.org/gruf/go-mutexes v1.3.1/go.mod h1:1j/6/MBeBQUedAtAtysLLnBKogfOZAxdym0E3wlaBD8=
|
codeberg.org/gruf/go-mutexes v1.4.0/go.mod h1:1j/6/MBeBQUedAtAtysLLnBKogfOZAxdym0E3wlaBD8=
|
||||||
codeberg.org/gruf/go-runners v1.6.2 h1:oQef9niahfHu/wch14xNxlRMP8i+ABXH1Cb9PzZ4oYo=
|
codeberg.org/gruf/go-runners v1.6.2 h1:oQef9niahfHu/wch14xNxlRMP8i+ABXH1Cb9PzZ4oYo=
|
||||||
codeberg.org/gruf/go-runners v1.6.2/go.mod h1:Tq5PrZ/m/rBXbLZz0u5if+yP3nG5Sf6S8O/GnyEePeQ=
|
codeberg.org/gruf/go-runners v1.6.2/go.mod h1:Tq5PrZ/m/rBXbLZz0u5if+yP3nG5Sf6S8O/GnyEePeQ=
|
||||||
codeberg.org/gruf/go-sched v1.2.3 h1:H5ViDxxzOBR3uIyGBCf0eH8b1L8wMybOXcdtUUTXZHk=
|
codeberg.org/gruf/go-sched v1.2.3 h1:H5ViDxxzOBR3uIyGBCf0eH8b1L8wMybOXcdtUUTXZHk=
|
||||||
|
|
|
@ -0,0 +1,87 @@
|
||||||
|
package mutexes
|
||||||
|
|
||||||
|
import (
|
||||||
|
"sync"
|
||||||
|
"unsafe"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Cond is similar to a sync.Cond{}, but
|
||||||
|
// it encompasses the Mutex{} within itself.
|
||||||
|
type Cond struct {
|
||||||
|
notify notifyList
|
||||||
|
sync.Mutex
|
||||||
|
}
|
||||||
|
|
||||||
|
// See: sync.Cond{}.Wait().
|
||||||
|
func (c *Cond) Wait() {
|
||||||
|
t := runtime_notifyListAdd(&c.notify)
|
||||||
|
c.Mutex.Unlock()
|
||||||
|
runtime_notifyListWait(&c.notify, t)
|
||||||
|
c.Mutex.Lock()
|
||||||
|
}
|
||||||
|
|
||||||
|
// See: sync.Cond{}.Signal().
|
||||||
|
func (c *Cond) Signal() { runtime_notifyListNotifyOne(&c.notify) }
|
||||||
|
|
||||||
|
// See: sync.Cond{}.Broadcast().
|
||||||
|
func (c *Cond) Broadcast() { runtime_notifyListNotifyAll(&c.notify) }
|
||||||
|
|
||||||
|
// RWCond is similar to a sync.Cond{}, but
|
||||||
|
// it encompasses the RWMutex{} within itself.
|
||||||
|
type RWCond struct {
|
||||||
|
notify notifyList
|
||||||
|
sync.RWMutex
|
||||||
|
}
|
||||||
|
|
||||||
|
// See: sync.Cond{}.Wait().
|
||||||
|
func (c *RWCond) Wait() {
|
||||||
|
t := runtime_notifyListAdd(&c.notify)
|
||||||
|
c.RWMutex.Unlock()
|
||||||
|
runtime_notifyListWait(&c.notify, t)
|
||||||
|
c.RWMutex.Lock()
|
||||||
|
}
|
||||||
|
|
||||||
|
// See: sync.Cond{}.Signal().
|
||||||
|
func (c *RWCond) Signal() { runtime_notifyListNotifyOne(&c.notify) }
|
||||||
|
|
||||||
|
// See: sync.Cond{}.Broadcast().
|
||||||
|
func (c *RWCond) Broadcast() { runtime_notifyListNotifyAll(&c.notify) }
|
||||||
|
|
||||||
|
// unused fields left
|
||||||
|
// un-named for safety.
|
||||||
|
type notifyList struct {
|
||||||
|
_ uint32 // wait uint32
|
||||||
|
notify uint32 // notify uint32
|
||||||
|
_ uintptr // lock mutex
|
||||||
|
_ unsafe.Pointer // head *sudog
|
||||||
|
_ unsafe.Pointer // tail *sudog
|
||||||
|
}
|
||||||
|
|
||||||
|
// See runtime/sema.go for documentation.
|
||||||
|
//
|
||||||
|
//go:linkname runtime_notifyListAdd sync.runtime_notifyListAdd
|
||||||
|
func runtime_notifyListAdd(l *notifyList) uint32
|
||||||
|
|
||||||
|
// See runtime/sema.go for documentation.
|
||||||
|
//
|
||||||
|
//go:linkname runtime_notifyListWait sync.runtime_notifyListWait
|
||||||
|
func runtime_notifyListWait(l *notifyList, t uint32)
|
||||||
|
|
||||||
|
// See runtime/sema.go for documentation.
|
||||||
|
//
|
||||||
|
//go:linkname runtime_notifyListNotifyOne sync.runtime_notifyListNotifyOne
|
||||||
|
func runtime_notifyListNotifyOne(l *notifyList)
|
||||||
|
|
||||||
|
// See runtime/sema.go for documentation.
|
||||||
|
//
|
||||||
|
//go:linkname runtime_notifyListNotifyAll sync.runtime_notifyListNotifyAll
|
||||||
|
func runtime_notifyListNotifyAll(l *notifyList)
|
||||||
|
|
||||||
|
// Ensure that sync and runtime agree on size of notifyList.
|
||||||
|
//
|
||||||
|
//go:linkname runtime_notifyListCheck sync.runtime_notifyListCheck
|
||||||
|
func runtime_notifyListCheck(size uintptr)
|
||||||
|
func init() {
|
||||||
|
var n notifyList
|
||||||
|
runtime_notifyListCheck(unsafe.Sizeof(n))
|
||||||
|
}
|
|
@ -3,7 +3,6 @@ package mutexes
|
||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"unsafe"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -250,37 +249,3 @@ func (mu *rwmutex) WaitRelock(outer *sync.Mutex) {
|
||||||
// Relock!
|
// Relock!
|
||||||
outer.Lock()
|
outer.Lock()
|
||||||
}
|
}
|
||||||
|
|
||||||
// unused fields left
|
|
||||||
// un-named for safety.
|
|
||||||
type notifyList struct {
|
|
||||||
_ uint32 // wait uint32
|
|
||||||
notify uint32 // notify uint32
|
|
||||||
_ uintptr // lock mutex
|
|
||||||
_ unsafe.Pointer // head *sudog
|
|
||||||
_ unsafe.Pointer // tail *sudog
|
|
||||||
}
|
|
||||||
|
|
||||||
// See runtime/sema.go for documentation.
|
|
||||||
//
|
|
||||||
//go:linkname runtime_notifyListAdd sync.runtime_notifyListAdd
|
|
||||||
func runtime_notifyListAdd(l *notifyList) uint32
|
|
||||||
|
|
||||||
// See runtime/sema.go for documentation.
|
|
||||||
//
|
|
||||||
//go:linkname runtime_notifyListWait sync.runtime_notifyListWait
|
|
||||||
func runtime_notifyListWait(l *notifyList, t uint32)
|
|
||||||
|
|
||||||
// See runtime/sema.go for documentation.
|
|
||||||
//
|
|
||||||
//go:linkname runtime_notifyListNotifyAll sync.runtime_notifyListNotifyAll
|
|
||||||
func runtime_notifyListNotifyAll(l *notifyList)
|
|
||||||
|
|
||||||
// Ensure that sync and runtime agree on size of notifyList.
|
|
||||||
//
|
|
||||||
//go:linkname runtime_notifyListCheck sync.runtime_notifyListCheck
|
|
||||||
func runtime_notifyListCheck(size uintptr)
|
|
||||||
func init() {
|
|
||||||
var n notifyList
|
|
||||||
runtime_notifyListCheck(unsafe.Sizeof(n))
|
|
||||||
}
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ codeberg.org/gruf/go-mangler
|
||||||
# codeberg.org/gruf/go-maps v1.0.3
|
# codeberg.org/gruf/go-maps v1.0.3
|
||||||
## explicit; go 1.19
|
## explicit; go 1.19
|
||||||
codeberg.org/gruf/go-maps
|
codeberg.org/gruf/go-maps
|
||||||
# codeberg.org/gruf/go-mutexes v1.3.1
|
# codeberg.org/gruf/go-mutexes v1.4.0
|
||||||
## explicit; go 1.14
|
## explicit; go 1.14
|
||||||
codeberg.org/gruf/go-mutexes
|
codeberg.org/gruf/go-mutexes
|
||||||
# codeberg.org/gruf/go-runners v1.6.2
|
# codeberg.org/gruf/go-runners v1.6.2
|
||||||
|
|
Loading…
Reference in New Issue