Re: [libvirt] PATCH: 9/25: Make global error object thread local

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

 



On Tue, Jan 13, 2009 at 05:42:15PM +0000, Daniel P. Berrange wrote:
> The virGetLastError() and virConnGetLastError() methods are not
> even remotely thread safe, and the virCopyLastError/virConnCopyLastError
> methods don't help in this goal, being open to a race condition.
> 
> This patch changes the internal impl of the global error object to
> store its virError instance in a thread local variable. All errors
> are now reported against the global error object. In the public
> API entry points, we explicitly reset the global error object to
> ensure no stale errors are hanging around. In all error paths we
> also set a generic error, if the internal driver forget to set an
> explicit error. Finally we also copy the global error to the per
> connection error object for back-compatability, though the global
> object remains non-threadsafe for application access.
> 
> 
>  src/datatypes.c          |   31 
>  src/datatypes.h          |   15 
>  src/libvirt.c            | 3276 ++++++++++++++++++++++++++++++++---------------
>  src/virterror.c          |  258 +++
>  src/virterror_internal.h |    5 
>  tests/cpuset             |    2 
>  tests/read-bufsiz        |    2 
>  tests/start              |    4 
>  tests/undefine           |    8 
>  tests/vcpupin            |    4 
>  10 files changed, 2507 insertions(+), 1098 deletions(-)

Yup, looks good, and also fixes lots of potential bugs where the
connection object might have been corrupted.  +1.

Rich.

-- 
Richard Jones, Emerging Technologies, Red Hat  http://et.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into Xen guests.
http://et.redhat.com/~rjones/virt-p2v

--
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]