Daniel P. Berrange wrote:
The problem is that we need to use pthread_t / pthread_create APIs
for
other parts of libvirt. libxml2 doesn't provide any portability layer
for threads - only for mutexes. Any platform which has pthread_t, already
has pthread_mutex_t, so although in theory the pthread_mutex_t is less
portable than xmlMutex, in practice the overall portability is the same
due to the constraint of needing pthread_t.
Don't be forgetting about Windows. MinGW has a pthread API, and Red Hat
also have one[1]. Whether they are the same or not I haven't found out yet.
The one thing I noticed is you need to be careful about pthread_t : on
Unix this is usually an int of some sort, but on Windows it's a
structure. You might also want to check [2] for some gotchas,
particularly around thread cancellation.
Rich.
[1]
http://sources.redhat.com/pthreads-win32/
[2]
http://sources.redhat.com/pthreads-win32/faq.html
--
Emerging Technologies, Red Hat -
http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom. Registered in
England and Wales under Company Registration No. 03798903