Re: GMutex advice needed



Hi Jeff,

> I need some GMutex advice. I have a C++ class that has a GMutex data 
> member. At run time there could be anything from one dervied class to 
> many derived classes in memory. I'm trying to decide which would be more 
> efficient. Should the base class declare the GMutex  data member static 
> so that every derived class shares the same mutex or would it be better 
> to declare the mutex non-static so that each derived class has its own. 
> I was concerned that overhead and performance would be an issue in the 
> latter case. Any advice would be a appreciated.

It depends on what you want to achive with the GMutex. If no two
instances of classes derived from your base class may be accessed at the
same time, you have to have one GMutex for all of them, i.e. a static
member. If only every individual instance has to be protected, make
GMutex a normal member of the base.

Bye,
Sebastian
-- 
Sebastian Wilhelmi                 |            här ovanför alla molnen
mailto:seppi seppi de              |     är himmlen så förunderligt blå
http://seppi.de                    |




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]