于 2012/5/14 7:40, K. Frank 写道:
> Hello All!
>
> I am finding that std::this_thread::sleep_for is not fully/properly 
> implemented.
>
> I am using Ruben's 64-bit mingw-w64 4.7.0<thread>-enabled build.
>
> When I try compiling:
>
>     g++ -std=c++0x -static -o test_sleep test_sleep.cpp
>
> the line:
>
>     std::this_thread::sleep_for (std::chrono::milliseconds(500));
>
> I get the error:
>
>     error: 'sleep_for' is not a member of 'std::this_thread'
>
> When I try compiling with the following magic incantation:
>
>     g++ -D_GLIBCXX_USE_NANOSLEEP -std=c++0x -static -o test_sleep 
> test_sleep.cpp
>
> I get the error:
>
>     In file included from test_sleep.cpp:
>     
> c:\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../include/c++/4.7.0/thread:
> In function 'void std::this_thread::sleep_for(const
> std::chrono::duration<_Rep, _Period>&)':
>     
> c:\mingw64\bin\../lib/gcc/x86_64-w64-mingw32/4.7.0/../../../../include/c++/4.7.0/thread:277:2:
> error: '::nanosleep' has not been declared
>
> Some background:
>
> Going back over my notes I see that when I was building my<thread>
> implementation I came across this same issue, but I never came back
> to sort it out or implement it properly.  (At the time I was focused on
> using sleep_for as part of a test for some of the other<thread>  stuff
> I had implemented, rather than on implementing sleep_for itself.  So
> I just moved forward by using the native windows sleep for my testing
> and overlooked coming back to get sleep_for working.)
>
> This looks like a semi-know issue in the gcc / linux world.  Here are
> a couple of semi-random references:
>
>     
> http://markmail.org/message/ufyrfwq6qjphewbm#query:+page:1+mid:4mui756gcycjvjnx+state:results
>     https://bugs.archlinux.org/task/27751
>
> (Hence my attempt to us -D_GLIBCXX_USE_NANOSLEEP.)
>
>
> Best.
>
>
> K. Frank
I think it need to rebuild gcc using --enable-libstdcxx-time=yes

-- 
Best Regards,
xunxun


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to