如何使用#include lt;thread>
答案:2 悬赏:0
解决时间 2021-02-14 10:07
- 提问者网友:北故人
- 2021-02-13 16:16
如何使用#include lt;thread>
最佳答案
- 二级知识专家网友:一池湖水
- 2021-02-13 17:18
class test
{
public:
static void output(const int a)
{
cout << a << endl;
}
void work(const int a)
{
thread th(output,a);
th.join();
}
};
{
public:
static void output(const int a)
{
cout << a << endl;
}
void work(const int a)
{
thread th(output,a);
th.join();
}
};
全部回答
- 1楼网友:错过的是遗憾
- 2021-02-13 17:49
#include
#include
void* print_xs (void* unused)
{
while (1)
fputc (‘x’, stderr);
return null;
}
int main ()
{
pthread_t thread_id;
pthread_create (&thread_id, null, &print_xs, null);
while (1)
fputc (‘o’, stderr);
return 0;
}
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯