2010/11/22 Daniel P. Berrange <berrange(a)redhat.com>:
To allow messages from different threads to be untangled,
include an integer thread identifier in log messages.
+int virThreadSelfID(void)
+{
+ HANDLE handle = GetCurrentThread();
+ HANDLE process = GetCurrentProcess();
+ HANDLE thread;
+ int id;
+
+ DuplicateHandle(process, handle, process,
+ &thread, 0, FALSE,
+ DUPLICATE_SAME_ACCESS);
+ id = (int)thread;
+ CloseHandle(thread);
+ return id;
+}
You could use GetCurrentThreadId() here instead of the handle value.
Matthias