diff options
author | 2024-01-22 14:33:51 +0000 | |
---|---|---|
committer | 2024-01-22 14:33:51 +0000 | |
commit | b3ba1516a78cba2144c517d78b7c39b536a0ed59 (patch) | |
tree | d5d0470e8e809a0d48e9c817b3900c303f0196ca /vendor/codeberg.org | |
parent | [feature] Allow "charset=utf8" in incoming AP POST requests (#2564) (diff) | |
download | gotosocial-b3ba1516a78cba2144c517d78b7c39b536a0ed59.tar.xz |
[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>
Diffstat (limited to 'vendor/codeberg.org')
-rw-r--r-- | vendor/codeberg.org/gruf/go-mutexes/cond.go | 87 | ||||
-rw-r--r-- | vendor/codeberg.org/gruf/go-mutexes/map.go | 35 |
2 files changed, 87 insertions, 35 deletions
diff --git a/vendor/codeberg.org/gruf/go-mutexes/cond.go b/vendor/codeberg.org/gruf/go-mutexes/cond.go new file mode 100644 index 000000000..d89040c02 --- /dev/null +++ b/vendor/codeberg.org/gruf/go-mutexes/cond.go @@ -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)) +} diff --git a/vendor/codeberg.org/gruf/go-mutexes/map.go b/vendor/codeberg.org/gruf/go-mutexes/map.go index 8a73a96d9..e61ef3537 100644 --- a/vendor/codeberg.org/gruf/go-mutexes/map.go +++ b/vendor/codeberg.org/gruf/go-mutexes/map.go @@ -3,7 +3,6 @@ package mutexes import ( "sync" "sync/atomic" - "unsafe" ) const ( @@ -250,37 +249,3 @@ func (mu *rwmutex) WaitRelock(outer *sync.Mutex) { // Relock! 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)) -} |