This is the mail archive of the gcc-bugs@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]

[Bug libstdc++/33578] New: libstdc++ parallel mode broken on mingw32


/develop/svn/trunk/build/mingw32/libstdc++-v3/include/parallel/compatibility.h:
In function 'void __gnu_parallel::yield()':
/develop/svn/trunk/build/mingw32/libstdc++-v3/include/parallel/compatibility.h:331:
error: 'Sleep' was not declared in this scope
make[4]: *** [parallel_list.lo] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-target-libstdc++-v3] Error 2
make: *** [all] Error 2

The 'obvious' fix is to just include <windows.h> for __MINGW32__ as well
as _MSC_VER to get the prototype for Sleep. However, I expect that would cause
many complaints because it would pollute the global namespace with all
the Win32api names.  These do cause problems in practice , especially when
porting non-Win32 apps to mingw32. The _GTHREAD_HIDE_W32API business in
gthr-win32.h was implemented precisely to avoid having to expose these
names in libstdc++.

>From a mingw point of view it would be better if __gnu_parallel::yield
could be hidden away either in a gthread_sched_yield function in libgcc
or in a libstdc++ object file.


Secondly, I don't think Sleep is actually the correct function to call
on NT4 and later

The  SwitchToThread() function which

"Causes the calling thread to yield execution to another thread that is
ready to run on the current processor. The operating system selects the
next thread to be executed."

may be better.

Danny


-- 
           Summary: libstdc++ parallel mode broken on mingw32
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dannysmith at users dot sourceforge dot net
 GCC build triplet: i686-pc-mingw32
  GCC host triplet: i686-pc-mingw32
GCC target triplet: i686-pc-mingw32


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


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