2009/7/4 François Perrad <[email protected]>: > 2009/7/4 MoC <[email protected]>: >>> 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 >> >> >
Index: include/parrot/parrot.h =================================================================== --- include/parrot/parrot.h (revision 39883) +++ include/parrot/parrot.h (working copy) @@ -102,10 +102,6 @@ typedef jmp_buf Parrot_jump_buff; #endif /* PARROT_HAS_HEADER_SETJMP */ -#ifdef PARROT_HAS_HEADER_PTHREAD -# include <pthread.h> -#endif /* PARROT_HAS_HEADER_PTHREAD */ - #ifdef PARROT_HAS_HEADER_LIMITS # include <limits.h> #endif /* PARROT_HAS_HEADER_LIMITS */
_______________________________________________ http://lists.parrot.org/mailman/listinfo/parrot-dev
