Web lists-archives.com

Re: [Mingw-users] GCC-4.9.3 is now our current release




(objc_thread_t *) is just a pointer to pthread_t in the gthr_posix wrapper so if it causes undefined behaviour it would be in pthread itself. winpthreads also use the .x pointer but its not opaque
like in pthreads-w32 and seems to only be used internally. the .p pointer is a handle to pthread itself. No code in objective-c uses the .x pointer i checked :) but im running the gcc test suite now which takes forever ;) if anything unusual turns up we can take it from there, so far it has passed all tests besides the ones that are unsupported on windows, but its not done running yet.

No compile warnings about the code either so it seems to be ok, 
gcc-5.3.0 is rather strict so if i goofed up i would have expected 
atleast a warning.

But lets see what the test says :)

Den 17-03-2016 kl. 14:21 skrev K. Frank:
> Hello Ralph!
>
> On Thu, Mar 17, 2016 at 1:37 AM, ralph engels <ralphengels@xxxxxxxxx> wrote:
>> Final patch :) everything works now.
>> ...
>> +#ifdef PTW32_VERSION
>> +    thread_id = (objc_thread_t) new_thread_handle.p;
> Yes, this is basically what your previous version was doing.
>
>     thread_id = *(objc_thread_t *) &new_thread_handle; /* fails with
>        pthreads-w32, cannot convert to a pointer type, changed a bit so now it
>        should */
>
> First you get a pointer to new_thread_handle (pointer to struct), then
> you cast it to (objc_thread_t *) (where I assume that objc_thread_t
> itself resolves to a pointer).  This is presumably "undefined behavior"
> (or maybe just becomes undefined behavior when the pointer is
> dereferenced ...), but we do this sort of thing all the time.  Then you
> dereference the pointer.  With luck, you hopefully end up setting
> thread_id to new_thread_handle.p, presumably a pointer to a native
> thread.  Maybe this is okay.
>
> But doing it more explicitly, as you do with:
>
>     thread_id = (objc_thread_t) new_thread_handle.p;
>
> is just better, and (potentially) avoids undefined behavior (depending
> on what the types of objc_thread_t and new_thread_handle.p turn
> out to be).
>
> I'm still a little nervous about this.  The pthreads-win32 people put
> the x data member into pthread_t for some reason.  I can't see why
> that would naturally be part of the thread id / thread handle, but that's
> what they did, so one might worry that you don't have a fully proper
> thread handle for objc_threat_t.
>
> Anyway, I don't know anything about objective-c, so I'm speaking
> beyond my competence.
>
>> ...
>> Thanks for the assistance, im not all to well versed in C++ syntax so
>> that one would have taken me a while.
> Thanks to you for sorting this all out for mingw!
>
>> Cheers ill start gathering up the patches and ship them to Keith, i
>> guess he will be majorly pleased ;)
>
> Best regards.
>
>
> K. Frank
>
> ------------------------------------------------------------------------------
> Transform Data into Opportunity.
> Accelerate data analysis in your applications with
> Intel Data Analytics Acceleration Library.
> Click to learn more.
> http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
> _______________________________________________
> MinGW-users mailing list
> MinGW-users@xxxxxxxxxxxxxxxxxxxxx
>
> This list observes the Etiquette found at
> http://www.mingw.org/Mailing_Lists.
> We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.
>
> _______________________________________________
> You may change your MinGW Account Options or unsubscribe at:
> https://lists.sourceforge.net/lists/listinfo/mingw-users
> Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe