'yield'不是'std :: this_thread'的成员 [英] 'yield' is not a member of 'std::this_thread'

查看:232
本文介绍了'yield'不是'std :: this_thread'的成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图产生当前线程:


std :: this_thread :: yield();

std::this_thread::yield();

但不幸的是,GCC知道得更好:

But unfortunately GCC knows better:


'yield' 'std :: this_thread'

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

我忘记了类似于D_GLIBCXX_USE_NANOSLEEP的一些黑客,还是什么?

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

推荐答案

是的,这似乎是类似于 _GLIBCXX_USE_NANOSLEEP 的问题。 GCC根据宏 _GLIBCXX_USE_SCHED_YIELD 有条件地编译 yield

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.

这将修正为GCC 4.8。

This will be fixed as of GCC 4.8.

这篇关于'yield'不是'std :: this_thread'的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆