Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'yield' is not a member of 'std::this_thread'

I tried to yield current thread:

std::this_thread::yield();

But unfortunately GCC knows better:

'yield' is not a member of 'std::this_thread'

Have I forgotten about some hack similar to D_GLIBCXX_USE_NANOSLEEP, or what?

like image 549
Dejwi Avatar asked Feb 04 '12 10:02

Dejwi


1 Answers

Yes, this appears to be an issue similar to the one with _GLIBCXX_USE_NANOSLEEP. GCC has yield conditionally compiled depending on the macro _GLIBCXX_USE_SCHED_YIELD. It should compile if you define that.

This will be fixed as of GCC 4.8.

like image 75
R. Martinho Fernandes Avatar answered Sep 20 '22 08:09

R. Martinho Fernandes