On Mon, Nov 3, 2014 at 12:00 PM, Taras Kondratiuk <taras.kondrat...@linaro.org> wrote: > On 11/03/2014 11:50 AM, Shmulik Ladkani wrote: >> >> Hi, >> >> 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.
How would you make existing threads call init_local_fn, it sounds complicated what you are describing here. The matter should be simpler, an application built on top of ODP should call odp_init_global from thread 0 as soon as possible and any threads created with odp_thread create should call odp_init_local as soon as possible. Any other threads spawned with regular pthread_create are not ODP threads, but you can do whatever you need in there. >> + * (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. Any initialization an application would need to do should not be affected by what ODP does in odp_thread_create before actually calling the thread function. If it does, then it sounds like something wrong in my opinion. It should be as simple as this: call odp_init_global from thread 0, spawn any number of threads using odp_thread_create and the threads initializing thread local data if they need to. > > > Could you please elaborate it? What is a usecase? > > > _______________________________________________ > lng-odp mailing list > lng-odp@lists.linaro.org > http://lists.linaro.org/mailman/listinfo/lng-odp _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org http://lists.linaro.org/mailman/listinfo/lng-odp