This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Committed: RE [Bug libstdc++/33578] __gnu_parallel::yield broken on mingw32



> ------- Comment #6 from bkoz at gcc dot gnu dot org  
> 2007-10-10 02:00 -------
> 
> Danny, if this allows compilation of parallel_list.cc then 
> please check your
> patch in, as it doesn't change semantics.
> 
> Then we can figure out what we really want here....
> 
This is what I have checked in after regtesting with make check-parallel
2007-10-11  Danny Smith  <dannysmith@users.sourceforge.net>

	PR libstdc++/33578
	* include/parallel/compatibility.h.  Use POSIX sched_yield on
	__CYGWIN__ 
	(Sleep): Add prototype for __MINGW32__.


Index: include/parallel/compatibility.h
===================================================================
--- include/parallel/compatibility.h	(revision 129215)
+++ include/parallel/compatibility.h	(working copy)
@@ -45,7 +45,7 @@
 #include <sys/atomic.h>
 #endif
 
-#if !defined(_WIN32)
+#if !defined(_WIN32) || defined (__CYGWIN__)
 #include <sched.h>
 #endif
 
@@ -56,6 +56,14 @@
 #undef min
 #endif
 
+#ifdef __MINGW32__
+// Including <windows.h> will drag in all the windows32 names.  Since
+// that can cause user code portability problems, we just declare the
+// one needed function here.
+extern "C"
+__attribute((dllimport)) void __attribute__((stdcall)) Sleep (unsigned
long);
+#endif
+
 namespace __gnu_parallel
 {
 #if defined(__ICC)
@@ -327,7 +335,7 @@
   inline void
   yield()
   {
-#ifdef _WIN32
+#if defined (_WIN32) && !defined (__CYGWIN__)
     Sleep(0);
 #else
     sched_yield();


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]