【发布时间】:2018-08-03 05:02:35
【问题描述】:
在 C++ Actor 框架中,我有一个 Actor(假设 A)调用另一个 Actor(假设 B),然后 B 的值必须在 A 的逻辑中使用。
为了更具体,代码如下:
behavior B(event_based_actor* self) {
return {
[=](const string& what) -> string {
return what;
}
};
behavior A(event_based_actor* self) {
return {
[=](const string& what, const actor& buddy) -> string {
self->request(buddy, std::chrono::seconds(10), what)
.then(
[=](string & data) {
aout(self) << data << endl;
}
what = data // here I have to use data and thats the issue
);
return what;
}
};
从代码中可以看出,我必须使用数据变量,它是 lambda 之外的演员 B 的结果,由于我是新手,因此将不胜感激。
演员 B 被另一个阻塞演员调用。
【问题讨论】:
标签: c++ actor c++-actor-framework