dkforest

A forum and chat platform (onion)
git clone https://git.dasho.dev/n0tr1v/dkforest.git
Log | Files | Refs | LICENSE

commit df6fbe4f81bc39f8aaa477b13964da5564fd1bac
parent c71d989cdd34685c0f7d339cdbd84e31e5a5017b
Author: n0tr1v <n0tr1v@protonmail.com>
Date:   Mon, 18 Dec 2023 04:33:53 -0500

mtx

Diffstat:
Mpkg/utils/utils.go | 9++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go @@ -1200,9 +1200,16 @@ func (m *RWMtx[T]) Val() *T { } func (m *RWMtx[T]) RWith(clb func(v *T)) { + _ = m.RWithE(func(tx *T) error { + clb(tx) + return nil + }) +} + +func (m *RWMtx[T]) RWithE(clb func(v *T) error) error { m.RLock() defer m.RUnlock() - clb(&m.v) + return clb(&m.v) } func (m *RWMtx[T]) With(clb func(v *T)) {