On Fri, Nov 12, 2010 at 02:18:31PM +0200, Andrew W. Nosenko wrote:
> On Fri, Nov 12, 2010 at 10:12, Arnold Hendriks <[email protected]> wrote:
[...]
> > See eg
> > http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=%2Fapis%2Fconcep17.htm
> > - a portable application cannot assume pthread_t is castable from/to an
> > integer.
> > (the first reference I found, but i'm sure it's in the posix specs too - the
> > issue comes up once in a while on comp.programming.threads)
> >
> > This is the pthread-win32 definition of pthread_t:
> >
> > typedef struct {
> > void * p; /* Pointer to actual object */
> > unsigned int x; /* Extra information - reuse count etc */
> > } ptw32_handle_t;
> >
> > typedef ptw32_handle_t pthread_t;
> >
> > and it's the reason why
> >
> > tid[i] = (pthread_t) -1;
> >
> > fails
Yeah, so far it breaks only on windows 64 bits though, but this need
fixing.
> > Setting tid[i] to pthread_self may not be in the right spirit for the tests
> > I guess, but I don't really know of another way to initialize a threadid.
It's not really the spirit but IMHO that was good enough, I nearly
commited that patch,
> memset(&tid[i], 0xff, sizeof(tid[i])) ?
>
> May be even replace whole
>
> for (i = 0; i < num_threads; i++) {
> results[i] = NULL;
> tid[i] = (pthread_t) -1;
> }
>
> by
> memset(results, 0, sizeof(*results)*num_threads);
> memset(tid, 0xff, sizeof(*tid)*num_threads);
The only "problem" is that 0xff based pointers may still look like
valid pointers, but that's probably the best option at this point, yes
if this test end up failing for some reason that will still be easy to
sort out.
So I commited and pushed your patch, thanks Andrew !
Daniel
--
Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/
[email protected] | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library http://libvirt.org/
_______________________________________________
xml mailing list, project page http://xmlsoft.org/
[email protected]
http://mail.gnome.org/mailman/listinfo/xml