2010/11/22 Daniel P. Berrange <[email protected]>:
> 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
[email protected]
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to