Richard Heck wrote:
> On 01/15/2011 04:54 PM, Pavel Sanda wrote:
>> Peter Kümmel wrote:
>>> When a thread enters a function which another thread is busy on it hangs
>>> in the lock, if it wouldn't wait the the chaos would become even worse.
>>> The mutex only guaranties that one operation is finished before the next
>>> starts.
>> yep, i know whot is mutex for. my question was about the graph scenario
>> problems.
>>
> I THINK that this will be OK, but please do not hold me to it.
>
> Each time we search the graph, we start anew. The basic underlying 
> structure stays the same: what formats we have, and what converters we 
> have. The search involves decorating (labeling) the graph, and all of that 
> gets reset each time. So, as I said, I think it is OK.
>
> That said, there are reasons we might want each Buffer to have its own copy 
> of the whole Graph structure, or perhaps to make one as it needs it. If we 
> see more problems, then we can go that way.

if Graph structure does not share any data between indepedent instances then
there is no need to safeguard it (maybe better to kill that one static until
we forget its potentiallly dangerous - or make it clear from naming that it
_must_ be always empty as you have written).

what actually needs safegaurd in contrast is converters object, where i would
propose to move the mutex stuff. it has one private graph structure and
multiple threads can access it in a single time - currently i'm aware of 3
independent entry points which can collide: you make export in background, you
open file with previews, and some ui action triggers isExportable in getStatus.
all of it touches converters object.

pavel

Reply via email to