[PATCH] Committed: RE [Bug libstdc++/33578] __gnu_parallel::yield broken on mingw32
Danny Smith
dannysmith@clear.net.nz
Wed Oct 10 23:46:00 GMT 2007
> ------- 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();
More information about the Libstdc++
mailing list