Re: [PATCH 6/8] perf annotate: Ensure init/exit for global options

From: Namhyung Kim
Date: Wed Nov 29 2023 - 19:01:59 EST


On Tue, Nov 28, 2023 at 11:21 AM Ian Rogers <irogers@xxxxxxxxxx> wrote:
>
> On Tue, Nov 28, 2023 at 9:54 AM Namhyung Kim <namhyung@xxxxxxxxxx> wrote:
> >
> > Now it only cares about the global options so it can just handle it
> > without the argument.
>
> If annotate_opts were accessed by a function then you could
> pthread_once the initialization on the first call to get
> annotate_opts. Removing annotation_options__init/exit would remove
> some potential for error.

Currently all call sites (perf annotate, report and top) initialize the
options and check if it has conflicting options before running the
commands. So I'm not sure if it needs pthread_once() for that.

Thanks,
Namhyung