Type required
Title revised rtl/instance.hxx double-checked locking "static" helpers
Posted by [EMAIL PROTECTED]
Affected ,sal,svtools,vcl
Effective from SRC680/dclocking


Summary

rtl/instance.hxx double-checked locking "static" helpers have been improved.


Description
Within cws dclocking the rtl/instance.hxx static helpers have been
improved:

- struct StaticInstance
o removed inheritance in Static, StaticAggregate:
referencing StaticInit, InitAggregate directly.
o removed third template parameter of Static
for custom init one can use new class StaticWithInit<>
(which also has not the drawback that the global mutex is acquired
during init)

There were only little changes to do on m56 (3 occurences in svtools,
vcl).

Info: new

+ template<typename T, typename InitData,
typename Unique = InitData, typename Data = "">class StaticWithInit

helper base class for for a late-initialized static variable,
implementing the double-checked locking pattern correctly, use e.g.

struct MyStatic : public rtl::StaticWithInit<MyType, MyStatic> {
MyType operator () () {
...
return MyType( ...
}
};
...
MyType & rStatic = MyStatic::get();

For details have a look at rtl/instance.hxx.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to