Re: [PATCH] Include a thread identifier in log messages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/11/22 Daniel P. Berrange <berrange@xxxxxxxxxx>:
> 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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]