]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/log.h
Better fix
[wxWidgets.git] / include / wx / log.h
index 254df43702c5a04ebfc1fc469bbf36c0c541e4ca..4d9523604271ef8422f6d77a1c594350411e4b3e 100644 (file)
 
 #include "wx/defs.h"
 
+#if wxUSE_THREADS
+    class WXDLLIMPEXP_FWD_BASE wxCriticalSection;
+#endif
+
 // ----------------------------------------------------------------------------
 // common constants for use in wxUSE_LOG/!wxUSE_LOG
 // ----------------------------------------------------------------------------
@@ -51,9 +55,11 @@ typedef unsigned long wxLogLevel;
 
 #include "wx/arrstr.h"
 
+#ifndef __WXPALMOS5__
 #ifndef __WXWINCE__
     #include <time.h>   // for time_t
 #endif
+#endif // ! __WXPALMOS5__
 
 #include "wx/dynarray.h"
 
@@ -301,20 +307,28 @@ protected:
     #define wxSUPPRESS_DOLOGSTRING_HIDE_WARNING()
 #endif
 
-    // log a line containing the number of times the previous message was
-    // repeated
-    // returns: the number
-    static unsigned DoLogNumberOfRepeats();
+    // log a message indicating the number of times the previous message was
+    // repeated if ms_prevCounter > 0, does nothing otherwise; return the old
+    // value of ms_prevCounter
+    unsigned LogLastRepeatIfNeeded();
 
 private:
+    // implement of LogLastRepeatIfNeeded(): it assumes that the
+    // caller had already locked ms_prevCS
+    unsigned LogLastRepeatIfNeededUnlocked();
+
     // static variables
     // ----------------
 
-    // traditional behaviour or counting repetitions
+    // if true, don't log the same message multiple times, only log it once
+    // with the number of times it was repeated
     static bool        ms_bRepetCounting;
+
+#if wxUSE_THREADS
+    static wxCriticalSection ms_prevCS; // protects the ms_prev values below
+#endif
     static wxString    ms_prevString;   // previous message that was logged
-    // how many times the previous message was logged
-    static unsigned    ms_prevCounter;
+    static unsigned    ms_prevCounter;  // how many times it was repeated
     static time_t      ms_prevTimeStamp;// timestamp of the previous message
     static wxLogLevel  ms_prevLevel;    // level of the previous message