我目前正在研究Bazel构建系统。我总是在Bazel脚本中看到@符号,但是找不到有关它的任何文档。我在Bazel网站上进行了搜索,但结果似乎没有用。 @在Bazel中。例如:
filegroup(
name = "toolchain_fg",
srcs = [
":cc-compiler-amd64",
"@x86_64_unknown_linux_gnu_gcc_730//:compiler_components",
],
)
Run Code Online (Sandbox Code Playgroud)
有人可以在这里为我解释@符号吗?
我知道我可以使用错误代码async_write,async_read检查断线。
但是,在我的情况下,收到东西后,我不能立即回信(或者回信可能永远不会发生)。
在读写之间,如何查看客户端掉线异常?
我在基于线程中启动了一个线程。该线程中调用了一个纯虚函数。我在派生类中实现它。
#include <iostream>
#include <memory>
#include <thread>
struct Base {
std::unique_ptr<std::thread> th;
virtual void foo() = 0;
void bar() {
th = std::make_unique<std::thread>(
[this](){
foo();
}
);
}
virtual ~Base(){
th->join();
}
};
struct Derived : public Base {
virtual void foo() override {
std::cout << "impl in derived" << std::endl;
}
};
int main() {
Derived d;
d.bar();
return 0;
}
Run Code Online (Sandbox Code Playgroud)
但是,在这些代码中,派生对象将在基础对象之前解构。
pure virtual method called
terminate called without an active exception
Aborted (core dumped)
Run Code Online (Sandbox Code Playgroud)
这种情况下如何控制销毁顺序呢?