On Mon, Jan 21, 2008 at 02:57:37PM +0000, Richard W.M. Jones wrote:
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.
Luckily the thread stuff should not be used in the remote driver - only
the xen/qemu/storage drivers, so we ought not to have to worry about that
(until we port the real drivers to windows :-)
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.
Yeah, thread cancellation is a horibble thing that I intend to stay
away from.
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules:
http://search.cpan.org/~danberr/ -=|
|=- Projects:
http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|