[libvirt-users] Is this Race Condition?

Zhihua Che zhihua.che at gmail.com
Thu Apr 5 10:06:43 UTC 2012


Hi, everyone

    I'm  writing application using libvirt and I need call
virDomainGetCPUStats to get domain cpu stats . I learn from API
reference that this function has to be called when domain is running.
So my question is if there is an atomic way to test the domain's state
and get its stats?

   Or, it's ok to call this function when domain is not active, but
caller just gets error returned.

   In my code, I just call it directly and return error. I wonder if
this programming practice has subtle problem like race condition.




More information about the libvirt-users mailing list