changed embedded mutex to private field (#217)
Some checks failed
sync / sync (push) Failing after 16m12s
test / test (push) Failing after 17m28s
coverage / build (push) Failing after 17m40s

This commit is contained in:
2025-05-25 03:15:03 +05:00
committed by GitHub
parent 0f8f12aee0
commit 13f90ff716
13 changed files with 151 additions and 151 deletions

View File

@@ -11,8 +11,8 @@ import (
)
type httpProfile struct {
server *http.Server
sync.Mutex
server *http.Server
mu sync.Mutex
running bool
}
@@ -21,8 +21,8 @@ var DefaultAddress = ":6060"
// Start the profiler
func (h *httpProfile) Start() error {
h.Lock()
defer h.Unlock()
h.mu.Lock()
defer h.mu.Unlock()
if h.running {
return nil
@@ -30,9 +30,9 @@ func (h *httpProfile) Start() error {
go func() {
if err := h.server.ListenAndServe(); err != nil {
h.Lock()
h.mu.Lock()
h.running = false
h.Unlock()
h.mu.Unlock()
}
}()
@@ -43,8 +43,8 @@ func (h *httpProfile) Start() error {
// Stop the profiler
func (h *httpProfile) Stop() error {
h.Lock()
defer h.Unlock()
h.mu.Lock()
defer h.mu.Unlock()
if !h.running {
return nil