[svn:parrot] r39873 trunk/include/parrot

François Perrad francois.perrad at gadz.org
Sat Jul 4 20:56:28 UTC 2009


2009/7/4 François Perrad <francois.perrad at gadz.org>:
> 2009/7/4 MoC <moc at coders-haven.net>:
>>> Index: /trunk/include/parrot/thr_windows.h
>>> ===================================================================
>>> --- /trunk/include/parrot/thr_windows.h (revision 37201)
>>> +++ /trunk/include/parrot/thr_windows.h (revision 39873)
>>> @@ -124,11 +124,11 @@
>>>  typedef void (*Cleanup_Handler)(void *);
>>>  -#ifndef _STRUCT_TIMESPEC
>>> -#  define _STRUCT_TIMESPEC
>>> +#ifndef HAVE_STRUCT_TIMESPEC
>>> +#  define HAVE_STRUCT_TIMESPEC
>>>  struct timespec {
>>>     time_t tv_sec;
>>>     long tv_nsec;
>>>  };
>>> -#endif /* _STRUCT_TIMESPEC */
>>> +#endif /* HAVE_STRUCT_TIMESPEC */
>>>   #  undef CONST
>>
>> I'd just like to add that I don't really think that Parrot's to blame here,
>> but rather pthreads-win32. I first got in touch with the "struct timespec"
>> issue when trying to cross-compile ruby-svn, which uses pthreads, with MinGW
>> GCC 3.4.5. (The pthreads headers weren't bundled yet, though the library
>> files were already included since they seem to have built MinGW itself with
>> pthreads support.) Back then I came to a similiar conclusion though wanted
>> to check on who's to blame. So I searched my VirtualBox Ubuntu's include
>> directory (since I'm not that familiar with the structure of *nix systems)
>> and found out that:
>> 1) _STRUCT_TIMESPEC appears to be used on *nix OS (I have to admit that only
>> checking Ubuntu might not allow me to say that, but since Ruby also used
>> this variant I think I should be right.)
>> 2) _STRUCT_TIMESPEC is actually defined somewhere within sys/time.h (or one
>> of the included headers) and is only defined in pthreads-win32's pthread.h
>> because by default it's not defined within MinGW.
>> So I think that it's rather pthreads-win32 that's responsible for this issue
>> than Parrot and I suggest we should contact pthreads-win32 and/or MinGW
>> about it.
>> Any other opinions?
>>
>
> This issue comes with the newest MinGW which supplies a include pthread.h,
> and the segregation between pthread & Windows thread is not perfect.
>
> We have 2 platform dependent includes thr_windows.h & thr_pthread.h
> - thr_windows.h includes windows.h (Parrot doesn't use pthread-win32,
> because we target all compiler available on Windows, not only Mingw)
> - thr_pthread.h includes pthread.h.
> Both are included by the generated include platform.h.
> parrot.h includes platform.h & pthread.h if exists.
>
> So, I suggest to remove the conditional inclusion of pthread.h in parrot.h
> and the definition of struct timespec in thr_windows.h.
>
> See, the attached patch.
> This patch needs validation on many platform before commit (not like r39873).
>

This first patch doesn't work on linux,
because the definition of struct timespec in time.h is not guarded.
(a guard is only used in linux/time.h)

So, a new patch that only removes the conditional inclusion of
pthread.h in parrot.h

François.

> François.
>
> Note:
> - the guard _STRUCT_TIMESPEC is used in thread.h, which is a common include.
> - the guard _STRUCT_TIMESPEC is not used by MinGW
>
>
>> --MoC
>>
>> _______________________________________________
>> http://lists.parrot.org/mailman/listinfo/parrot-dev
>>
>>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pthread-mingw-v2.patch
Type: text/x-diff
Size: 483 bytes
Desc: not available
URL: <http://lists.parrot.org/pipermail/parrot-dev/attachments/20090704/b0702f94/attachment.bin>


More information about the parrot-dev mailing list