腾讯云
开发者社区
文档
建议反馈
控制台
登录/注册
首页
学习
活动
专区
圈层
工具
MCP广场
文章/答案/技术大牛
搜索
搜索
关闭
发布
文章
问答
(9999+)
视频
沙龙
1
回答
使用
std
::
async
编辑
数组
、
、
这个想法是并行地对
数组
的每个元素执行操作。::vector<dataContainer> arrData;
std
::vector<
std
::future<void>results.emplace_back(
std
::
async
(
std
::launch::
async
, [](dataContainer& ttData) {::
async
调
浏览 4
提问于2017-07-30
得票数 1
回答已采纳
2
回答
std
::
async
未
使用
std
::launch::
async
策略启动新线程
、
、
、
、
如果我
使用
std
:: launch ::
async
策略启动
std
::
async
,它不应该在新线程中启动每个异步任务吗?目前看来,新的异步任务将移动到刚刚完成其工作的线程中。我
使用
VC11作为我的编译器。从输出中可以看出,当
使用
std
::
async
启动新的工作线程(例如,一个工作进程多次获得ID为34500的线程)时,它将在之前完成的线程中启动。我对
std
::
async
的理解是错误的,还是有一个底层的
浏览 2
提问于2012-07-14
得票数 4
回答已采纳
2
回答
boost asio中带有异步功能的错误字符
、
、
、
使用
以下代码:void Server::accept(void) Network::ptr connection = Network::create(this->my_acceptor.get_io_service()); { this->rcv_msg = this->rbu
浏览 0
提问于2011-11-16
得票数 0
回答已采纳
2
回答
是否
使用
std
::launch::sync模拟
std
::
async
?
、
、
、
我知道有
std
::
async
和
std
::launch::sync,但是如何
使用
boost和vs2010来模拟它呢?
std
::unique_future<int> foo() return
std
::
async
(
std
::launch::sync, [=] return prime
浏览 3
提问于2012-01-22
得票数 0
回答已采纳
4
回答
GCC
使用
std
::
async
(
std
::launch::
async
)的行为与Clang的行为
、
、
、
、
有没有人有
使用
过相当新的
std
::
async
的经验?我们目前正在实现一个并行文件解析器,它读取文件块并将该块传递给异步函数。
使用
Clang (v3.0)时,这种方式与默认的
std
::
async
策略(依赖于实现)配合得很好。在双核机器上,它最多激发4个线程,运行得非常好。
使用
std
::launch::
async
,两个版本做的几乎是一样的(应该是什么情况)。 有谁知道目前GCC的c++11线程化能力的现状?或者这可能是我们的实现中的一个错
浏览 2
提问于2012-04-08
得票数 11
回答已采纳
2
回答
在
std
::packaged_task中
使用
成员函数
、
、
我尝试组合
std
::(packaged_task|
async
|future),但我没有让它工作。// when it gets triggered to start at some certain point
std
::future<bool> result; foo() : task(do_so
浏览 0
提问于2013-06-25
得票数 6
回答已采纳
2
回答
启动一个守护进程线程,它是类的一个私有方法?
、
、
我对C++11线程很陌生,我正在尝试做以下事情:public: this->task_ =
std
::threadthis->isRunning = false; this->stop();
std
::atomic<bool> isRunning_;
浏览 2
提问于2016-05-21
得票数 5
回答已采纳
1
回答
在构造函数中
使用
std
::异步
、
、
我对C++11特性
std
::
async
非常陌生,我无法理解为什么下面的代码从不打印bar。
std
::
async
(
std
::launch::
async
, &Thready::foo, this); while (true) {
std
::cout
浏览 5
提问于2016-10-13
得票数 1
回答已采纳
1
回答
使用
线程化函数在二维
数组
中查找最大条目
、
、
我在一个二维随机双精度
数组
中找到最大的条目。::future<void> thread1 =
std
::
async
(
std
::launch::
async
, getLargest, myArray, largestEntry, 0, portion, dim);
std
::future<void> thread2 =
std
::
async
(
std
::launch::<e
浏览 12
提问于2015-11-05
得票数 0
1
回答
std
::异步保证在返回语句后运行
、
、
示例: int do_smth(
std
::function<void()> callback) int id= 0; future =
std
::
async
(
std
::launch::
async
, cb);return id;
std
::
as
浏览 2
提问于2015-09-14
得票数 2
1
回答
绑定到
std
::函数转换问题
、
、
尝试
使用
以下代码从
std
::bind()获取函数对象:mqtt::
async
_client*,callback*,sql::Driver*)> fn =
std
::bind(&driver_manager::test_callback, &driverManager错误:从‘
std
::_Bind_helpe
浏览 2
提问于2021-07-07
得票数 6
2
回答
c++中的线程化,查找二维
数组
中的最大条目
、
、
我在
使用
线程函数的二维
数组
中查找最大的条目时遇到了一些问题。我已经盯着屏幕好几个小时了,我需要一些帮助。::future<void> thread1 =
std
::
async
(
std
::launch::
async
, getLargest, myArray, largestEntry, 0, portion, dim);
std
::future<void> thread2 =
std
::
async
(<e
浏览 1
提问于2015-11-06
得票数 1
1
回答
将
std
::
async
与
std
::launch::
async
一起
使用
时出现奇怪的行为
、
、
我正在试图理解C++11中引入的
std
::
async
和
std
::futures。::future<int> f1 =
std
::
async
(
std
::launch::
async
, hog_cpu); cout
浏览 10
提问于2018-09-07
得票数 0
回答已采纳
2
回答
std
::
async
参数太多
、
、
、
好的,我试图在一个项目中
使用
std
::future,但是我
使用
的
std
::
async
总是告诉我有太多的参数。
编辑
:这是一个最小的可重现的例子,很抱歉第一个例子。::future<int> FN1 =
std
::
async
(
std
::launch::
async
, F, 1, 2, 3);
std
::future<int> FN2 =
std
::
浏览 67
提问于2020-03-19
得票数 1
回答已采纳
2
回答
对
std
的包装::
std
()不能工作
、
编辑
:对
std
::bind()的调用可以替换为其他东西,我只想让runAsyncTerminateOnException()
使用
与
std
::异步()相同的签名,就像对它的包装一样注意:我不会修改print()函数签名,这是一个示例。我希望包装器是通用的,并处理通过直接调用
std
::异步()处理的所有可能的参数。(
st
浏览 6
提问于2016-12-13
得票数 0
回答已采纳
1
回答
“`FnOnce`”的实现在异步递归中不够通用
、
我创建了一个最小的例子来说明我所面临的问题:use
async
_recursion::
async
_recursion;
async
fn foo() -> Result<()> {
async
fn bar(it:
浏览 15
提问于2022-02-03
得票数 2
回答已采纳
2
回答
boost asio
async
_write :如何不交织
async
_write调用?
、
、
以下是我的实现:有什么简单的方法可以避免这个问题吗?
编辑
1:如果客户端C在客户端A之后向客户端B发送消息,同样的问题就会出现.
编辑</
浏览 1
提问于2011-10-13
得票数 31
回答已采纳
3
回答
析构函数和异步任务
、
、
、
我有一个类,它
使用
构造函数中的
std
::
async
调用异步任务来加载其内容。代码如下所示:{} {} 在我的主线程中有几个这些对象被创建和删除的实例,它们可以在任何时候
浏览 3
提问于2015-04-11
得票数 2
回答已采纳
1
回答
在主线程中执行boost::期货::
、
、
::
async
(boost::launch::
async
, []()
std
::cout<<"
async
thread id : "<<boost::this_thread:
编辑
:f1的目的 boost::异步可能会运行一些繁重的任务,如果我不让这个任务在另一个thread.After上运行,那么它很可能会阻塞gui,我想告诉gui并执行一些与gui相关的操作,这就是为什么我
使用
编辑
:看起来延迟可以
浏览 1
提问于2014-08-15
得票数 3
回答已采纳
2
回答
使用
std
::bind将QTimer::singleShot传递到
std
::异步
、
、
、
_ =
std
::
async
( [this] { QTimer::singleShot(1000,替换lambda函数,我已经成功地替换了第二个lambda,如下所示: 我做了几次失败的尝
浏览 0
提问于2018-05-08
得票数 0
回答已采纳
点击加载更多
相关
资讯
【Rust日报】2021-01-16 Async-std v1.9.0 发布
【大家的项目】socks5-rs 一个使用async-std的异步socks5 server实现
Shell数组的使用
php数组使用全集(二)
Javascript 数组的创建与使用
热门
标签
更多标签
云服务器
ICP备案
实时音视频
云直播
对象存储
活动推荐
运营活动
广告
关闭
领券