Hi all!
> Some speculation on the nanosleep issue:
>
> My copy of thread.cc (the gcc implementation for std::thread) has some code
> protected by
>
> #ifdef _GLIBCXX_USE_NANOSLEEP
>
> When I compile thread.cc (without doing anything special in my environment)
> _GLIBCXX_USE_NANOSLEEP appears not to be defined, and everything works.
> However, if I define _GLIBCXX_USE_NANOSLEEP, e.g., on the g++ command
> line, I get a compile-time error: "'::nanosleep' has not been declared".
>
> So I speculate that nanosleep is an "optional" facility, perhaps provided by
> the
> linux pthreads or other unix-style library.
>
>
No!
Look the code from thread header file:
> 259#ifdef _GLIBCXX_USE_NANOSLEEP 260 /// sleep_for 261 template<typename
> _Rep, typename _Period> 262 inline void 263 sleep_for(const
> chrono::duration<_Rep, _Period>& __rtime) 264 { 265 chrono::seconds __s =
> 266 chrono::duration_cast<chrono::seconds>(__rtime); 267
> 268chrono::nanoseconds __ns =
> 269 chrono::duration_cast<chrono::nanoseconds>(__rtime - __s); 270
> 271__gthread_time_t __ts =
> 272 { 273 static_cast<std::time_t>(__s.count()),
> 274static_cast<long>(__ns.count())
> 275 }; 276 277 ::nanosleep(&__ts, 0); 278 } 279 280 /// sleep_until
> 281template<typename _Clock, typename _Duration>
> 282 inline void 283 sleep_until(const chrono::time_point<_Clock,
> _Duration>& __atime) 284 { sleep_for(__atime - _Clock::now()); } 285#endif
If _GLIBCXX_USE_NANOSLEEP is not defined then std::thread::sleep_for() and
std::thread::sleep_until() will be excluded.
niXman.
------------------------------------------------------------------------------
Got Input? Slashdot Needs You.
Take our quick survey online. Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public