
22 Nov
2010
22 Nov
'10
8:02 p.m.
2010/11/22 Daniel P. Berrange <berrange@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