From 8e03bb88ab8b60b52baafc4f909bddc1c2323cb5 Mon Sep 17 00:00:00 2001 From: Ian Rogers Date: Fri, 26 Aug 2022 09:42:28 -0700 Subject: perf hist: Update use of pthread mutex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switch to the use of mutex wrappers that provide better error checking. Signed-off-by: Ian Rogers Reviewed-by: Adrian Hunter Acked-by: Namhyung Kim Cc: Alexander Shishkin Cc: Alexandre Truong Cc: Alexey Bayduraev Cc: Andi Kleen Cc: Andres Freund Cc: Andrii Nakryiko Cc: André Almeida Cc: Athira Jajeev Cc: Christophe JAILLET Cc: Colin Ian King Cc: Dario Petrillo Cc: Darren Hart Cc: Dave Marchevsky Cc: Davidlohr Bueso Cc: Fangrui Song Cc: Hewenliang Cc: Ingo Molnar Cc: James Clark Cc: Jason Wang Cc: Jiri Olsa Cc: Kajol Jain Cc: Kim Phillips Cc: Leo Yan Cc: Mark Rutland Cc: Martin Liška Cc: Masami Hiramatsu Cc: Nathan Chancellor Cc: Nick Desaulniers Cc: Pavithra Gurushankar Cc: Peter Zijlstra Cc: Quentin Monnet Cc: Ravi Bangoria Cc: Remi Bernon Cc: Riccardo Mancini Cc: Song Liu Cc: Stephane Eranian Cc: Thomas Gleixner Cc: Thomas Richter Cc: Tom Rix Cc: Weiguo Li Cc: Wenyu Liu Cc: William Cohen Cc: Zechuan Chen Cc: bpf@vger.kernel.org Cc: llvm@lists.linux.dev Cc: yaowenbin Link: https://lore.kernel.org/r/20220826164242.43412-5-irogers@google.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/hist.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tools/perf/util/hist.c') diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c index 1c085ab56534..698add038cec 100644 --- a/tools/perf/util/hist.c +++ b/tools/perf/util/hist.c @@ -1622,13 +1622,13 @@ struct rb_root_cached *hists__get_rotate_entries_in(struct hists *hists) { struct rb_root_cached *root; - pthread_mutex_lock(&hists->lock); + mutex_lock(&hists->lock); root = hists->entries_in; if (++hists->entries_in > &hists->entries_in_array[1]) hists->entries_in = &hists->entries_in_array[0]; - pthread_mutex_unlock(&hists->lock); + mutex_unlock(&hists->lock); return root; } @@ -2805,7 +2805,7 @@ int __hists__init(struct hists *hists, struct perf_hpp_list *hpp_list) hists->entries_in = &hists->entries_in_array[0]; hists->entries_collapsed = RB_ROOT_CACHED; hists->entries = RB_ROOT_CACHED; - pthread_mutex_init(&hists->lock, NULL); + mutex_init(&hists->lock); hists->socket_filter = -1; hists->hpp_list = hpp_list; INIT_LIST_HEAD(&hists->hpp_formats); -- cgit v1.2.3-59-g8ed1b