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

2007-10-10 Thread dannysmith at gcc dot gnu dot org


--- Comment #7 from dannysmith at gcc dot gnu dot org  2007-10-10 23:39 
---
Subject: Bug 33578

Author: dannysmith
Date: Wed Oct 10 23:39:30 2007
New Revision: 129219

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129219
Log:
PR libstdc++/33578
* include/parallel/compatibility.h.  Use POSIX sched_yield on
__CYGWIN__ 
(Sleep): Add prototype for __MINGW32__.


Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/parallel/compatibility.h


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33578



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

2007-10-09 Thread bkoz at gcc dot gnu dot org


--- 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


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33578



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

2007-10-09 Thread dannysmith at users dot sourceforge dot net


--- Comment #5 from dannysmith at users dot sourceforge dot net  2007-10-09 
23:54 ---
(In reply to comment #2)
> Created an attachment (id=14332)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14332&action=view) [edit]
> Consistent use of _WIN32 define
> 
Thats not quite right.  ___MINGW32__ defines _WIN32 but doesn't have an
intrin.h.  I believe that is for MSVC compiler specific intrinsics.  _MSC_VER
is a MSVC compiler builtin define.

Also, Cygwin  __may__ define _W32 (with -mwin32 switch) but still should use
its own implementation of  and sched_yield  since it uses pthreads 


I'll attach what I'm using currently.  Putting more #ifdef's into this file
certainly doesn't make it any prettier. If wanted, I could prepare a patch that
gets rid of *all* the non-GNU (Windows) stuff and just put a __MINGW32__
specific definition of a __gnu_parallel::sched_yield() into os_defines.h. 

FWIW,  boost uses Sleep(1) -- not Sleep(0) --  for sched_yield() on windows,
while cygwin use SwitchToThread()


Dann\y


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33578



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

2007-10-09 Thread dannysmith at users dot sourceforge dot net


--- Comment #4 from dannysmith at users dot sourceforge dot net  2007-10-09 
23:52 ---
Created an attachment (id=14334)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14334&action=view)
mingw32 compatibility patch


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33578



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

2007-10-09 Thread bkoz at gcc dot gnu dot org


--- Comment #3 from bkoz at gcc dot gnu dot org  2007-10-09 22:41 ---

Actually, I think that when I added sched.h, I forgot to look at the windows
stuff. Something seems off to me, WRT the current code. The includes don't
match the code...

Here's a patch to make the conditionals in the includes match the conditionals
in the code. I'm not quite sure how _MSC_VER fits into this, or SwitchToThread. 


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33578



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

2007-10-09 Thread bkoz at gcc dot gnu dot org


--- Comment #2 from bkoz at gcc dot gnu dot org  2007-10-09 22:38 ---
Created an attachment (id=14332)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14332&action=view)
Consistent use of _WIN32 define


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33578



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

2007-10-09 Thread bkoz at gcc dot gnu dot org


--- Comment #1 from bkoz at gcc dot gnu dot org  2007-10-09 22:24 ---

Ah yes, this one.

I believe there is controversy around this implementation point on linux as
well.

Here's some info from previous discussions between myself, Ulrich, and
Johannes.

Me:
Include  for sched_yield in . Should this be
pthread_yield or other approaches? 

Uli:
Using sched_yield/pthread_yield is almost always wrong.  I'd have to
look at the specific code.  If you can summarize it I can easily answer
questions.

Johannes:
Well, it really helps for work-stealing algorithms, in particular if
they use more threads than there are processors available at the time,
which can change even during execution. It makes some decision based on
the current load on the machine, which requires some OS interaction.
That's the easiest and most robust way to do it.

It is probably time to resume this discussion.


-- 

bkoz at gcc dot gnu dot org changed:

   What|Removed |Added

 AssignedTo|unassigned at gcc dot gnu   |bkoz at gcc dot gnu dot org
   |dot org |
 Status|UNCONFIRMED |ASSIGNED
 Ever Confirmed|0   |1
   Last reconfirmed|-00-00 00:00:00 |2007-10-09 22:24:54
   date||
Summary|libstdc++ parallel mode |__gnu_parallel::yield broken
   |broken on mingw32   |on mingw32


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33578