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

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

 



On Fri, Jan 16, 2009 at 10:01:01PM +0100, Jim Meyering wrote:
> "Daniel P. Berrange" <berrange@xxxxxxxxxx> 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.
> 
> 
> ACK.

This is applied now.

> -----------------------------------------
> However, I did notice one tiny problem:
> There are many uses of TODO, like this:
> 
>   -    if (domain == NULL) {
>   -        TODO
>   -        return (-1);
>   -    }
>   +    virResetLastError();
> 
> Obviously not a compile-time problem, since it's defined to nothing,
> but with no following semicolon, it would cause automatic indenting
> tools to do the wrong thing.

We should probably just remove the remaining TODO blocks - they're not
really doing much useful at this point.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

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