[Libguestfs] [PATCH] lib: Add thread-safety to global list of handles.

Richard W.M. Jones rjones at redhat.com
Mon Dec 7 11:26:19 UTC 2009


On Mon, Dec 07, 2009 at 12:20:10PM +0100, Jim Meyering wrote:
> Richard W.M. Jones wrote:
> > Subject: [PATCH] lib: Add thread-safety to global list of handles.
> >
> > This commit uses the Gnulib 'lock' module to implement a mutex on
> > the global list of handles which is stored by the library.
> >
> > Note that Gnulib nicely avoids explicitly linking with -lpthread
> > unless the application program itself links to -lpthread.  Locks
> > are only enabled in multithreaded applications.
> >
> > $ ldd src/.libs/libguestfs.so.0.217.0
> > 	linux-vdso.so.1 =>  (0x00007fffcb7ff000)
> > 	libc.so.6 => /lib64/libc.so.6 (0x00007f96a4e6c000)
> > 	/lib64/ld-linux-x86-64.so.2 (0x00007f96a544d000)
> >
> > Please enter the commit message for your changes. Lines starting
> > ---
> >  bootstrap     |    1 +
> >  m4/.gitignore |    2 ++
> >  src/guestfs.c |   19 ++++++++++---------
> 
> Hi Rich,
> That change looks fine.
> However, don't you want to link with $(LIBTHREAD)?
> 
> This is from gnulib/modules/lock:
> 
>     Link:
>     $(LTLIBTHREAD) when linking with libtool, $(LIBTHREAD) otherwise
> 
> which should imply you see that advice when running gnulib-tool
> (albeit along with hundreds of other less-important lines)

Damn, I just pushed this one :-(

I'll push an update with your suggested change, which seems like
it is correct.

(BTW I want to link with LTLIBTHREAD, right?)

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list