Python
Java
PHP
IOS
Android
Nodejs
JavaScript
Html5
Windows
Ubuntu
Linux
c++11 中的 std::thread 问题
我在尝试从标准模板库编译具有多线程的程序时遇到一些麻烦 当我尝试编译以下程序时 它返回一个晦涩的错误 include
c
Multithreading
g
std
stdthread
在 C++ 中使用 std::atomic 与 std::condition_variable 暂停和恢复 std::thread 的方法
这是一个单独的问题 但与我问的上一个问题相关here https stackoverflow com questions 40544480 c correct way to pause resume an stdthread 4054476
c
C11
stdthread
stdatomic
能否在 C++11 中检索线程函数的返回值?
如果一个函数有一个非空返回值并且我使用 join那么函数有没有办法获取它的返回值呢 这是一个简化的示例 float myfunc int k return exp k int main std thread th std thread my
c
Multithreading
C11
stdthread
C++ 11 std::thread 奇怪的行为
我正在尝试使用 std thread 和 C 11 并且遇到了奇怪的行为 请看一下下面的代码 include
Multithreading
C11
stdthread
在 C++11 智能指针中存储 std::thread
In C 11 多于有什么优点或缺点当存储一个std thread直接作为班级成员 如下所示 std thread my thread 与存储相反std shared ptr or std unique ptr像这样的线程 std shar
c
C11
c14
sharedptr
stdthread
C++11 std::threads 并等待线程完成
我有一个计时器对象向量 每个计时器对象都会启动一个模拟生长期的 std thread 我正在使用命令模式 发生的情况是每个计时器都被一个接一个地执行 但我真正想要的是一个被执行 然后一旦完成 下一个 一旦完成下一个 同时不干扰主程序的执行
c
Multithreading
C11
stdthread
当 main() 退出时,分离的线程会发生什么?
假设我正在开始一个std thread进而detach 它 所以线程继续执行 即使std thread曾经代表它的东西已经超出了范围 Assume further that the program does not have a relia
c
Multithreading
C11
exit
stdthread
在 C++11 中通过引用传递对象到 std::thread
为什么创建对象时不能通过引用传递对象std thread 例如 以下片段给出编译错误 include
c
Multithreading
C11
passbyreference
stdthread
C++11线程,在主线程上运行
我正在尝试 C 11 线程进行一些开发 我想在异步线程中运行一些代码 当该代码完成后 我想在主线程上运行其他代码但只有当它完成时 这是因为我想要运行异步的事情是加载 OpenGL 的东西 并且在执行线程时使用 OpenGL 上下文有点棘手
c
OpenGL
Asynchronous
C11
stdthread
C++11 中的线程池
相关问题 关于 C 11 C 11 std 线程池 https stackoverflow com questions 12993451 c11 stdthread pooled C 11 中的 async launch async 是否会
c
Multithreading
C11
ThreadPool
stdthread
Eclipse 内容辅助无法识别 std::thread,但可以正确编译
我运行的是 Ubuntu 14 04 我采取的重现步骤 创建一个新的C 项目 New gt C gt Hello World 项目 我称之为TestStdThread 将主文件中的代码更改为 include
c
eclipse
Ubuntu
eclipsecdt
stdthread
如何在 C++ 中将 std::thread::id 转换为字符串?
如何打字std thread id在C 中字符串 我正在尝试对由生成的输出进行类型转换std this thread get id 到字符串或字符数组 auto myid this thread get id stringstream ss
c
Multithreading
stdthread
实现完美转发到 std::thread 的函数
我正在尝试写一个包装器std thread include
c
C11
gcc
variadictemplates
stdthread
是否可以定义一个 std::thread 并稍后初始化它?
我的目标是保持std thread对象作为数据成员 并在需要时初始化它 我无法执行此操作 如下面的代码所示 因为std thread类被删除 还有其他方法吗 class MyClass public MyClass DiskJobThrea
c
copyconstructor
stdthread
std::thread 在 cygwin 中有效,但在 MinGw 中无效
所以我今天决定尝试一下c 我下载了MinGw和它附带的g 编译器 我决定测试以下代码 include
c
C11
Cygwin
MinGW
stdthread
使用 VS2012 RC 时,如果在 main() 退出后调用 std::thread::join() 则会挂起
如果在 Ubuntu 12 04 上使用 Clang 3 2 或 GCC 4 7 编译 以下示例会成功运行 即不会挂起 但如果使用 VS11 Beta 或 VS2012 RC 编译 则会挂起 include
c
visualc
C11
stdthread
visualc2012
C++ 11:使用成员函数并将 this 作为参数启动线程
使用这段代码 我得到了错误 错误 1 错误 C2064 术语未计算为采用 1 个参数的函数 c program files x86 microsoft Visual Studio 11 0 vc include featured 1152
c
Multithreading
C11
stdthread
在并发创建线程之前读取修改的变量是否安全?
pseudocode for illustration int g 0 void fn if g 1 std cout lt lt hello lt lt std endl else std cout lt lt world lt lt s
c
Multithreading
memorybarriers
stdthread
memorymodel
为什么在将临时变量传递给线程函数时移动构造函数会被调用两次? [复制]
这个问题在这里已经有答案了 在下面的代码中 我无法理解为什么类的移动构造函数被调用两次 因为我的线程函数通过右值引用获取参数 所以我希望当参数移动到线程构造函数时 移动构造函数只会被调用一次 有人可以给出关于线程构造函数如何工作以及如何将参
c
Multithreading
std
stdthread
perfectforwarding
C++多线程之std::thread
C 11 包含头文件 thread h 并使用命名空间std thread类提供的方法 方法 描述 thread 构造函数 在这里传入线程执行函数 和函数参数 get id 返回std thread id 这是一个类 可以间接得到unsig
02 C
C11多线程
stdthread
threadid
1
2
»