On 07/31/2016 01:38 PM, 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 think the URL there is broken.

> 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.

Thanks. There are surely a lot of hidden problems here. The LyX code was
not originally written with thread-safety in mind. It was only when
background
export was added that these issues became relevant.

> 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?

It looks to me as if most of the ones that are left are in
src/frontends/. It would
surely be worth fixing these, but I doubt they actually cause problems,
at least as
the code is now. We only ever have one GUI thread. For thar reason, the
switch
from static to thread_local in GuiDocument, say, will have no practical
effect at
the moment.

> 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?

I went through and marked these some time ago. I believe I checked all
static
variables, and the ones I did not mark I guess I thought were safe. I
ought to
have added a comment in such cases.

> 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).

Also probably worth doing.

Richard


Reply via email to