[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/phonon
From: Matthias Kretz <kretz () kde ! org>
Date: 2008-03-14 14:08:41
Message-ID: 1205503721.181579.12793.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 785627 by mkretz:
merge from branch: in the common case the GLOBAL_STATIC is already constructed. In \
that case calling operator!() and operator TYPE *() on the QAtomicPointer is not such \
a terribly good idea (the pointer is declared as volatile inside QAtomicPointer). \
KCacheGrind says execution improves by 0.5% for release builds, it's quite noticable \
for debug builds, though.
M +8 -7 globalstatic_p.h
--- trunk/KDE/kdelibs/phonon/globalstatic_p.h #785626:785627
@@ -262,20 +262,21 @@
} \
inline TYPE *operator->() \
{ \
- if (!_k_static_##NAME) { \
+ TYPE *p = _k_static_##NAME; \
+ if (!p) { \
if (isDestroyed()) { \
qFatal("Fatal Error: Accessed global static '%s *%s()' after \
destruction. " \
"Defined at %s:%d", #TYPE, #NAME, __FILE__, __LINE__); \
} \
- TYPE *x = new TYPE ARGS; \
- if (!_k_static_##NAME.testAndSetOrdered(0, x) \
- && _k_static_##NAME != x ) { \
- delete x; \
+ p = new TYPE ARGS; \
+ if (!_k_static_##NAME.testAndSetOrdered(0, p)) { \
+ delete p; \
+ p = _k_static_##NAME; \
} else { \
- static Phonon::CleanUpGlobalStatic cleanUpObject = { destroy }; \
\ + static Phonon::CleanUpGlobalStatic cleanUpObject = { destroy }; \
} \
} \
- return _k_static_##NAME; \
+ return p; \
} \
inline TYPE &operator*() \
{ \
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic