+#if wxUSE_THREADS
+
+// define static functions providing access to the critical sections we use
+// instead of just using static critical section variables as log functions may
+// be used during static initialization and while this is certainly not
+// advisable it's still better to not crash (as we'd do if we used a yet
+// uninitialized critical section) if it happens
+
+static inline wxCriticalSection& GetTraceMaskCS()
+{
+ static wxCriticalSection s_csTrace;
+
+ return s_csTrace;
+}
+
+static inline wxCriticalSection& GetPreviousLogCS()
+{
+ static wxCriticalSection s_csPrev;
+
+ return s_csPrev;
+}
+
+#endif // wxUSE_THREADS
+