+#ifdef USE_PTHREADS
+ /*
+ * TRACE_ICALLS is "really" needed to show normal use with threaded
+ * applications, since anything can be running during a napms(),
+ * making it appear in the hierarchical trace as it other functions
+ * are being called.
+ *
+ * Rather than add the complication of a per-thread stack, just
+ * show the thread-id in each line of the trace.
+ */
+# if USE_WEAK_SYMBOLS
+ if ((pthread_self))
+# endif
+#ifdef __MINGW32__
+ fprintf(TraceFP, "%#lx:", (long) (intptr_t) pthread_self().p);
+#else
+ fprintf(TraceFP, "%#lx:", (long) (intptr_t) pthread_self());
+#endif
+#endif