On 16.01.2011 20:01, Richard Heck wrote:
On 01/16/2011 06:08 AM, Peter Kümmel wrote:
HEAD without the locks in Graph.cpp

It's a typical race condition, see output with attached patch:

I'm no expert on this stuff, but it looks to me as if the locks are
needed, unless we start copying the Graph object every time we use it.
That could get expensive since, as Pavel noted, we call "isExportable"
or whatever quite a lot.

That said, it occurred to me when working on the Graph class that
there's really no reason not to cache the answers to questions like: Do
we know how to export PDF? If the converters change, then we would have
to clear that cache, but it's silly to keep answering that question. Not
that this would really help with the present problem....


When the implementation of Graph would be really const correct, means
we could drop the mutable, then calling a const function from several
threads should be no problem. And making Graph const correct could
be done by simply cache all results.
So caching could also help here ;)

Peter

Reply via email to