Hi Guillaume,

Just my 2 cents about those recent commits:

1) Switching to C++11 thread is a good thing
2) All these #if (gcc 4.6) are uglyfying the code considerably, you should enter C++11 with 2 steps or just leave it.

Thanks,
Abdel

On 31/07/2016 19:38, Guillaume Munch wrote:
Hi list,


By touching upon the problem of static variables and threading in LyX
(see my patch at <http://mid.gmane.org/nltsru$pag$1...@ger.gmane.org>), I
have the impression that I opened Pandora's box.

I just committed a series of patches that fixes "FIXME thread" in cases
where c++11 gives an easy solution for common problems, with some
explanations which you may enjoy.

Here's an additional patch that uses thread_local instead of static to
fix, I think, threading issues for some of the cases (e.g. when caching
some value for optimisation purpose). But I'd like to hear some comments
before committing.

For other "FIXME thread" issues, either the solution is more complex, or
using statics is inappropriate altogether (I think). Is there a plan to
get rid of these?

Also, when reviewing the use of non-const static variables, I found many
cases where thread-safety was not obvious to me but no "FIXME thread"
comment was present. Is it known whether the remaining static variables
without "FIXME thread" are thread-safe?

Ideally, I think it would be nice to only use statics when necessary,
and use the new tools provided by C++11 (see my recent commits and the
attached patch).


Guillaume

Reply via email to