From 5792bc6d99ea0c8c35a77aa9083a3097c43ff69a Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 9 Feb 2010 17:39:43 +0000 Subject: [PATCH] Introduced NOTIFY macro to help out with avoiding using of streams with notification level is below the user defined cutoff. This addition has been introduced to help out with avoid threading performance issues with the Microsoft ostream implementation. --- include/osg/Notify | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/osg/Notify b/include/osg/Notify index 46fca135d..194c268a0 100644 --- a/include/osg/Notify +++ b/include/osg/Notify @@ -75,6 +75,15 @@ extern OSG_EXPORT std::ostream& notify(const NotifySeverity severity); inline std::ostream& notify(void) { return notify(osg::INFO); } +#define NOTIFY(level) if (level>isNotifyEnabled(level)) osg::notify(level) + +#if _DEBUG + #define DEBUG_NOTIFY(level) if (level>isNotifyEnabled(level)) osg::notify(level) +#else + // when using an optimized build use if (false) to tell the compiler to ignore the rest of the notify. + #define DEBUG_NOTIFY(level) if (false) osg::notify(level) +#endif + /** Handler processing output of notification stream. It acts as a sink to * notification messages. It is called when notification stream needs to be * synchronized (i.e. after osg::notify() << std::endl).