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

Jim Meyering jim at meyering.net
Mon Dec 7 11:35:30 UTC 2009


Richard W.M. Jones wrote:

> 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?)

Oops.  Yes, since we're using libtool.




More information about the Libguestfs mailing list