![](/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.