![](/img/trans.png)
[英]pthread_mutex_lock and pthread_mutex_lock in another thread
[英]boost thread pthread_mutex_lock issue
// Copyright (C) 2001-2003
// William E. Kempf
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/thread/thread.hpp>
#include <iostream>
using namespace std;
void helloworld()
{
std::cout << "Hello World!" << std::endl;
}
int main()
{
boost::thread thrd(&helloworld);
thrd.join();
std::cout<<"sdfsfsd"<<endl;
}
从教程以及其他许多示例中获得的错误如下。
我在OS X 10.8.2上的xcode 4.6.2上,使用sudo端口安装了boost 1.54,并链接了所有标头搜索路径和库,并添加了dylib。 有人可以告诉我这是什么问题。 如果没有加入,它有时会与“ hello world”和“ sdfsfsd”一起插入文本,因为它不是在等待线程完成,而是有时也会给我这个错误。 谢谢!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.