[lxc-devel] [PATCH] remove static_lock()/static_unlock() and start to use thread local storage (v2)
Serge Hallyn
serge.hallyn at ubuntu.com
Mon Dec 23 15:30:07 UTC 2013
Quoting Andrey Mazo (mazo at telum.ru):
> Since lxc_global_config_value() tries to cache return value (exactly in "values" array) to avoid rereading config file multiple times for the same option, we can't just allocate "values" array on stack.
> Also, it would require all callers to free() returned memory.
> ifdef approach should work though.
>
> But we can also go another way: instead of parsing config file LXC_GLOBAL_CONF on demand (and reading through it multiple times),
> we can parse it once upon startup (before becoming multithreaded) thus eliminating the need for __thread or locking and still keeping "values" array static.
> Or am I missing something?
That might work. THe values may be overriden by argument passing, but
that again is done in all lxc_* programs before becoming mulitthreaded.
-serge
More information about the lxc-devel
mailing list