Hi Taras,

On Mon, 03 Nov 2014 12:00:33 +0200 Taras Kondratiuk 
<taras.kondrat...@linaro.org> wrote:
> On 11/03/2014 11:50 AM, Shmulik Ladkani wrote:
> > I'd like to suggest the following addition to odp_init.h:
> >
> > diff --git a/platform/linux-generic/include/api/odp_init.h 
> > b/platform/linux-generic/include/api/odp_init.h
> > index 8e018cbdba..9b75609fc7 100644
> > --- a/platform/linux-generic/include/api/odp_init.h
> > +++ b/platform/linux-generic/include/api/odp_init.h
> > @@ -108,6 +108,15 @@ int odp_term_global(void);
> >    */
> >   int odp_init_local(void);
> >
> > +/**
> > + * Register a function to be called upon thread local initialization
> > + *
> > + * XXX: Should the 'init_local_fn' be invoked for currently existing 
> > threads?
> > + *      Probably yes.
> > + *      (Alternative: user must call 'odp_init_local_register' before the
> > + *      first 'odp_init_local' call)
> > + */
> > +int odp_init_local_register(int (*init_local_fn)(void));
> >
> > Motivation is to allow a custom library built on top of ODP to
> > initialize its per-thread local data structures.
> 
> Could you please elaborate it? What is a usecase?

Think of a library extending the ODP library.

Specifically, I was playing around creating a C++ STL compatible
allocator template, whose implementation is based on ODP building
blocks.

(Well, I assume that most ODP apps would be written in C, and even if
written in C++, they'd probably use ODP memory allocation interfaces
directly for their specific needs. However such a library *could* allow
one to use STL data structures allocated by ODP means).

Such a library is unaware of how many threads its user will create, but
it needs to initialize some per-thread locals it has.

An 'odp_init_local_register' interface would allow one to do so, and
it's pretty harmful as it exposes none of ODP's internals.

The registered function may use any standard interfaces the ODP allows.

Regards,
Shmulik

_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to