草庐IT

background-thread

全部标签

c++ - Visual Studio 2010 中的 boost::thread 编译错误

我在很长一段时间内第一次尝试使用boost,当我包含boost/thread.hppheader时,我在boost本身内部遇到编译错误:c:\myproj\boost_1_46_0\boost\thread\win32\thread_heap_alloc.hpp(97):errorC2061:syntaxerror:identifier'heap_memoryc:\myproj\boost_1_46_0\boost\thread\detail\thread.hpp(134):seereferencetofunctiontemplateinstantiation'T*boost::det

c++ - 链接 boost::thread

我正在尝试使用boost库学习一些东西,但是当我尝试编译包含boost::threads的东西时遇到了问题。我在链接过程中遇到错误,消息如下:/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/bin/ld:cannotfind-lboost-thread但这很奇怪,因为只有当我用普通用户编译时才会发生这种情况,使用root我可以毫无问题地编译。提前致谢。 最佳答案 包含#include其他链接器标志-lboost_system-lboost_

c++ - debian 和 std::thread c++ 的即时段错误

遇到这个问题-在标题中..我有这个代码:#include#includevoidmy_thread_func(){std::cout摘自网络某处。编译器选项-pthread-std=gnu++0x(也试过-std=c++0x)而且我有段错误。一切都在vmBox上的Debian上。我之前已经启动了其他代码,并且它们有效。突然间,我在所有工作应用程序中使用std::thread的线程上出现段错误。编辑:这是来自gdb:(gdb)where#00x00000000in??()#10x08048dc9inthread(this=0xbffff3fc,__f=0x8048b9f)at/usr/i

c++ - OpenMP Mac OSX Lion c++ 链接器错误 Undefined symbols for architecture x86_64 : "_omp_get_thread_num"

我在互联网上的任何地方都找不到这个问题。所以我的链接器错误是:Undefinedsymbolsforarchitecturex86_64:"_omp_get_thread_num()"这是我的代码:intnthreads;inttid;#pragmaompparallelprivate(tid){tid=omp_get_thread_num();if(tid==0){nthreads=omp_get_num_threads();printf("numberofthreads:%d\n",nthreads);}} 最佳答案 看起来你忘

c++ - OpenCV C++ : How to slow down background adaptation of BackgroundSubtractorMOG?

我在OpenCV中使用BackgroundSubtractorMOG来跟踪对象。当它们出现时,它工作正常,但背景会快速适应,因此我无法跟踪静态对象。我怎样才能使背景适应变慢(我不希望它完全静态,只是变慢)?使用构造函数设置学习率不会改变:BackgroundSubtractorMOGpBSMOG=BackgroundSubtractorMOG(???);我该如何解决这个问题?谢谢! 最佳答案 BackgroundSubtractorMOGpBSMOG=BackgroundSubtractorMOG(inthistory=200,in

在内容脚本中从background.js拨打事件侦听器

我有一个活动听众background.js如下:chrome.webRequest.onHeadersReceived.addListener(function(details){.....})如何从内容脚本中调用此事件侦听器?看答案您无法从内容脚本触发任何触发任何WebRequestAPI事件侦听器。基本上的定义onHeadersReceived如下所示。每次收到HTTP响应标头时,都会射击。由于重定向和身份验证请求,每个请求可能会多次发生。此事件旨在允许扩展添加,修改和删除响应标头,例如传入的set-cookie标头。缓存指令是在此事件触发之前处理的,因此修改标题(例如高速公司)对浏览器的

C++:具有 `std::lock_guard` 的互斥量是否足以同步两个 `std::thread`?

我的问题是基于下面的C++代码示例#include#include#include#includeclassClassUtility{public:ClassUtility(){}~ClassUtility(){}voiddo_something(){std::coutlock(g_mutex);std::coutlock(g_mutex);std::cout如果需要,这更像是一个问题,目的是让我的理解更清楚,并获取std::condition_variable的示例用法。我有2个C++std::thread,它们在main方法中启动。它是osx上的控制台应用程序。所以使用clang编

c++ - Windows XP 样式 : Why do we get dark grey background on static text widgets?

我们正在使用C++和Win32编写Windows桌面应用程序。我们的对话框具有“WindowsXP风格”的丑陋外观:静态文本的背景是灰色的。对话框背景也是灰色的,这不是问题,但是在选项卡控件中,背景是白色的,文本的灰色背景非常明显。过去我们自己绘制了很多控件,但现在我们正在尝试尽可能多地使用标准外观,并尽可能避免覆盖标准行为。我们使用的是Win32API,它有点过时了,但我认为即使使用ATL也会出现问题。我们正在创建一个DIALOGTEMPLATE。文本位于“静态”控件(0x0082)中。我们为样式设置的唯一标志是“SS_LEFT”。文本控件位于选项卡控件内:“SysTabContro

c++ - Thread Sanitizer 是否可用?

我想尝试线程清洁剂(http://code.google.com/p/data-race-test/wiki/ThreadSanitizer#Using_ThreadSanitizer)所以我做了一个简单的程序:#include#include#include#include#include#includeusingnamespacestd;intviolated=0;mutexmtx;voidviolator(){lock_guardlg(mtx);violated++;}intmain(){threadt1(violator);t1.join();threadt2(violator

c++ - 从 std::thread 调用 boost::asio::io_service::run

我有一个处理我的连接的类,它有一个boost::asio::io_service成员。我想从std::thread调用io_service::run(),但我遇到了编译错误。std::threadrun_thread(&boost::asio::io_service,std::ref(m_io_service));不起作用。我看到了使用boost::thread执行此操作的各种示例,但我想为此坚持使用std::thread。有什么建议么?谢谢 最佳答案 我知道有两种方法,一种是通过lambda创建std::thread。std::t