On Wed, Jul 19, 2017 at 11:59:00PM +0800, 陳培泓 wrote:
Is pread_device thread-safe?
My result always shows pread_device can't get reply and corrupted
The current API is *not* thread safe. You need this branch which adds
thread safety by acquiring locks around calls:
https://github.com/rwmjones/libguestfs/commits/threads
It also needs reviewing so it can go upstream -- see previous postings
on this list.
I want to test performance on reading one 1GB qcow2 file in python
I create multiple threads and read the qcow2 file by pread_device function
in python. And these threads share the same guest handler and device
However this still won't work, even with thread safety (at least it
should no longer crash).
What you actually want is not just thread safety but parallelism, and
that requires some deeper changes, including using multiple
connections between the library and the daemon, and a multi-threaded
daemon. This has all been planned for a long time, but no one has got
around to doing the work.
Rich.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
Read my programming and virtualization blog:
http://rwmj.wordpress.com
Fedora Windows cross-compiler. Compile Windows programs, test, and
build Windows installers. Over 100 libraries supported.
http://fedoraproject.org/wiki/MinGW