[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150615212841.GA6458@krava.redhat.com>
Date: Mon, 15 Jun 2015 23:28:41 +0200
From: Jiri Olsa <jolsa@...hat.com>
To: Arnaldo Carvalho de Melo <acme@...nel.org>
Cc: Jiri Olsa <jolsa@...nel.org>, lkml <linux-kernel@...r.kernel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
Andi Kleen <ak@...ux.intel.com>,
David Ahern <dsahern@...il.com>,
Ingo Molnar <mingo@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH 07/30] perf tools: Add reference counting for thread_map
object
On Mon, Jun 15, 2015 at 04:25:44PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Sun, Jun 14, 2015 at 10:19:22AM +0200, Jiri Olsa escreveu:
> > Adding refference counting for thread_map object, so
> > it could be easily shared among other objects.
> >
> > Using thread_map__put instead thread_map__delete and making
> > thread_map__delete static.
>
> <SNIP>
>
> > +struct thread_map *thread_map__get(struct thread_map *map)
> > +{
> > + atomic_inc(&map->refcnt);
> > + return map;
> > +}
> > +
> > +void thread_map__put(struct thread_map *map)
> > +{
> > + if (map && atomic_dec_and_test(&map->refcnt))
> > + thread_map__delete(map);
> > }
>
> See comment on the other struct being refcounted, get/put should
> both accept NULL maps, to avoid having to check it in the users,
> just like with free().
ook, will repost with the get function fix
thanks,
jirka
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists