2010/12/4 Eric Blake <eblake@xxxxxxxxxx>: > * src/util/threads.h (virThreadID): New prototype. > * src/util/threads-pthread.c (virThreadID): New function. > * src/util/threads-win32.c (virThreadID): Likewise. > * src/libvirt_private.syms (threads.h): Export it. > * daemon/event.c (virEventInterruptLocked): Use it to avoid > warning on BSD systems. > --- > diff --git a/src/util/threads-pthread.c b/src/util/threads-pthread.c > index bff4979..826b9d1 100644 > --- a/src/util/threads-pthread.c > +++ b/src/util/threads-pthread.c > @@ -197,6 +198,11 @@ int virThreadSelfID(void) > Â#endif > Â} > > +int virThreadID(virThreadPtr thread) > +{ > + Â Âreturn (int)(uintptr_t)thread->thread; > +} > + > Âvoid virThreadJoin(virThreadPtr thread) > Â{ > Â Â pthread_join(thread->thread, NULL); > diff --git a/src/util/threads-win32.c b/src/util/threads-win32.c > index 436b3bd..2f4bcfc 100644 > --- a/src/util/threads-win32.c > +++ b/src/util/threads-win32.c > @@ -304,6 +304,11 @@ int virThreadSelfID(void) > Â Â return (int)GetCurrentThreadId(); > Â} > > +int virThreadID(virThreadPtr thread) > +{ > + Â Âreturn (int)thread->thread; > +} > + > > Âvoid virThreadJoin(virThreadPtr thread) > Â{ > diff --git a/src/util/threads.h b/src/util/threads.h > index fa00a91..de28db6 100644 > --- a/src/util/threads.h > +++ b/src/util/threads.h > @@ -51,7 +51,12 @@ int virThreadCreate(virThreadPtr thread, > Âvoid virThreadSelf(virThreadPtr thread); > Âbool virThreadIsSelf(virThreadPtr thread); > Âvoid virThreadJoin(virThreadPtr thread); > + > +/* These next two functions are for debugging only, since they are not > + * guaranteed to give unique values for distinct threads on all > + * architectures. */ > Âint virThreadSelfID(void); > +int virThreadID(virThreadPtr thread); > This solve the problem, but it should also be noted that virThreadSelfID and virThreadID cannot be used for comparison as they are not taken from the same source. ACK. Matthias -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list