Skip to content

Commit f9e2958

Browse files
honeynilmaranqz
andauthored
fix: correct mutex unlock in IsClosed.Err() method> (#129)
* fix: correct mutex unlock in IsClosed.Err() method> * extend test to catch this problem in the future --------- Co-authored-by: ilia.sergunin <[email protected]>
1 parent 9f2e5ea commit f9e2958

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

trm/drivers/is_closed.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (a *IsClosed) CloseWithCause(err error) {
7070
// Err is inspired function Err in https://pkg.go.dev/context#Context
7171
func (a *IsClosed) Err() error {
7272
a.mu.RLock()
73-
defer a.mu.RLock()
73+
defer a.mu.RUnlock()
7474

7575
return a.err
7676
}

trm/drivers/is_closed_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ func TestIsClose(t *testing.T) {
1818

1919
require.True(t, isClosed.IsActive())
2020
require.False(t, isClosed.IsClosed())
21+
require.NoError(t, isClosed.Err())
2122

2223
wg := sync.WaitGroup{}
2324

0 commit comments

Comments
 (0)