c++ - 如何从字符串中转换回 Boost::thread::id?

标签 c++ multithreading boost boost-thread

所以我投了boost::lexical_cast<std::string>(boost::this_thread::get_id())此线程 ID 为字符串。现在我想知道是否可以将它转回 thread::id?

最佳答案

既然你提到调用 ->interrupt,我假设你需要 boost::thread 对象,而不是 boost::thread:id 对象。

您最好的选择可能是在生成线程时创建字符串 - boost::thread 对象的映射。

关于c++ - 如何从字符串中转换回 Boost::thread::id?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7136135/

相关文章:

c++ - 如何使用 C++ 中的 Eigen 库加速我的函数?

c++ - 从 C 访问 C++ 模板

multithreading - Postgres 锁在不同的 goroutine 上表现不一致

c++ - C++ 库之间的差异(命名空间、链接)

c++ - 将 -lboost_serialization 添加到 Eclipse C++ IDE

c++ - 'O_RDONLY', `F_SETFL` , 'O_NONBLOCK' 遵循 OpenGL 教程时未声明的错误

c++ - 无法将 GLFW 库与其在 Ubuntu 18.04 上的头文件链接起来

java - 创建另一个线程

c# - 如何强制线程使用 C# 中的一组方法

python - 创建 boost-python 嵌套命名空间