#include "wx/defs.h"
-#include "wx/thread.h"
-
// ----------------------------------------------------------------------------
// common constants for use in wxUSE_LOG/!wxUSE_LOG
// ----------------------------------------------------------------------------
#include "wx/arrstr.h"
+#ifndef __WXPALMOS5__
#ifndef __WXWINCE__
#include <time.h> // for time_t
#endif
+#endif // ! __WXPALMOS5__
#include "wx/dynarray.h"
static void SetTraceMask(wxTraceMask ulMask) { ms_ulTraceMask = ulMask; }
// add string trace mask
- static void AddTraceMask(const wxString& str)
- { ms_aTraceMasks.push_back(str); }
+ static void AddTraceMask(const wxString& str);
// add string trace mask
static void RemoveTraceMask(const wxString& str);
// remove all string trace masks
static void ClearTraceMasks();
- // get string trace masks
- static const wxArrayString &GetTraceMasks() { return ms_aTraceMasks; }
+ // get string trace masks: note that this is MT-unsafe if other threads can
+ // call AddTraceMask() concurrently
+ static const wxArrayString& GetTraceMasks() { return ms_aTraceMasks; }
// sets the time stamp string format: this is used as strftime() format
// string for the log targets which add time stamps to the messages; set
// 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
- static unsigned LogLastRepetitionCountIfNeeded();
+ unsigned LogLastRepeatIfNeeded();
private:
+ // implement of LogLastRepeatIfNeeded(): it assumes that the
+ // caller had already locked ms_prevCS
+ unsigned LogLastRepeatIfNeededUnlocked();
+
// static variables
// ----------------
// with the number of times it was repeated
static bool ms_bRepetCounting;
- wxCRIT_SECT_DECLARE(ms_prevCS); // protects the ms_prev values below
static wxString ms_prevString; // previous message that was logged
static unsigned ms_prevCounter; // how many times it was repeated
static time_t ms_prevTimeStamp;// timestamp of the previous message