Questions tagged [boost-thread]

Boost.Thread enables the use of multiple threads of execution with shared data in portable C++ code.

Boost.Thread enables the use of multiple threads of execution with shared data in portable C++ code. It provides classes and functions for managing the threads themselves, along with others for synchronizing data between the threads or providing separate copies of data specific to individual threads.

The Boost.Thread library was originally written and designed by William E. Kempf. For Boost 1.35+, Anthony Williams performed a major rewrite designed to closely follow the proposals presented to the C++ Standards Committee, in particular N2497, N2320, N2184, N2139, and N2094.

As of Boost version 1.50.0 Boost.Thread provides an almost complete implementation of the C++ 2011 Threads library, plus extensions such as shared locks and thread interruption.

885 questions
0
votes
1 answer

Waiting for thread to die in destructor of pure virtual class causes runtime error

I am trying to wait for a thread to die in the destructor of a pure virtual class. The code compiles just fine, and appears to make sense. However, the following error occurs when running it: pure virtual method called terminate called without an…
Mad Physicist
  • 107,652
  • 25
  • 181
  • 264
0
votes
1 answer

How to release heap memory of thread local storage

I have a structure used for thread local storage like this: namespace { typedef boost::unordered_map< std::string, std::vector > YYY; boost::thread_specific_ptr cache; void initCache() { //The first time called by the current…
rahman
  • 4,820
  • 16
  • 52
  • 86
0
votes
2 answers

killing a separate thread having a socket

I have a separate thread ListenerThread having a socket listening to info broadcasted by some remote server. This is created at the constructor of one class I need to develop. Because of requirements, once the separate thread is started I need to…
user311906
  • 1,575
  • 2
  • 14
  • 17
0
votes
1 answer

Statically link Boost Thread 1.56 lib in an Xcode 6 project

I have a very simple Xcode 6 project in which I'm trying to link to boost_thread and boost_system statically. I've build the libraries (I have the libboost_thread.a and libboost_system.a), I've included all the right header/library search paths,…
bitwise
  • 541
  • 6
  • 16
0
votes
1 answer

How does a portable Thread Specific Storage Mechanism's Naming Scheme Generate Thread Relative Unique Identifiers?

A portable thread specific storage reference/identity mechanism, of which boost/thread/tss.hpp is an instance, needs a way to generate a unique keys for itself. This key is unique in the scope of a thread, and is subsequently used to retrieve the…
0
votes
0 answers

Possible causes to crash during boost::thread spawning

Executing `boost::thread(boost::bind(&SomeClass::someStaticFunction, someParam));` sometimes causing a crash. Please notice that the function is static. The trace I see is: * thread #35: tid = 0x2a822, 0x00d2469e…
Sanich
  • 1,739
  • 6
  • 25
  • 43
0
votes
1 answer

C++ creating thread inside a class gives c2064

Recently i started using boost::thread (also tried with STL - thread) in order to build a chat. I made at my "server-station" a class that has void function that get calls from main.cpp which starting the server listening + binding void function…
ToastMaster
  • 135
  • 1
  • 9
0
votes
1 answer

c++ threaded db class memory mixup

I've been working on a project that accepts data from various hosts and injects it into a database. This project is threaded via boost::thread, and uses mysql++ to perform the actual database injections. Lately, I've been having a serious problem…
Oblivious12
  • 61
  • 1
  • 7
0
votes
0 answers

boost::thread_group - how to avoid exception when join_all is called and thread is not joinable?

I receive AccessViolationException at this line in boost library if ((*it)->joinable()) when I call join_all method. This is my code: void TransactionsApi::UnscheduleThreads() { work = false; threadGroup.join_all(); //…
Oleg Vazhnev
  • 23,239
  • 54
  • 171
  • 305
0
votes
0 answers

OpenCV imshow in Boost Threads

Below is the code for a tracking module. A detector is launched and when it detects the object of interest, it creates a tracker object to track the object using camshift on a number of frames until the detector finds another object. The code seems…
Stralo
  • 474
  • 4
  • 16
0
votes
0 answers

Multithreading with boost and opencv

I already wrote a program that detects different objects, and i'm now working on a tracking module to track the objects of interest. Because the detection isn't as fast, I'm hoping to pass in one frame with the detected objects about every 10-30…
Stralo
  • 474
  • 4
  • 16
0
votes
2 answers

Invoking a boost::thread from the GUI (wxwidgets) and pass a callback function

I have a GUI program with wxwidgets. When a Button is clicked, a new thread is supposed to start and run, so that it doesn't block the UI. From the thread, a function is called that takes a callback function as argument. When I run the program…
tzippy
  • 6,458
  • 30
  • 82
  • 151
0
votes
3 answers

Linux: get Thread ID by handle from boost::thread

I'm using boost::thread (which is in a next step using pthread) but would like to get the thread id / (lightweight) pid by the boost::thread pointer. I manage to do this with windows by using the member native_handle() but I couldn't find an…
Hhut
  • 1,128
  • 1
  • 12
  • 24
0
votes
1 answer

Is static memory cleaned up by a different thread?

So, what happened in my project was the following: I have a singleton which is defined in a usual way: Singleton* Singleton::getInstance() { static Singleton instance; return &instance; } in its constructor, this singleton object initializes a…
0
votes
1 answer

Boost upgrade_to_unique_lock compilation error

I'm writing an app using Boost.Thread. Unfortunatelly, after moving new version to the 'production' environment I can't compile the project. g++ says: /usr/include/boost/thread/locks.hpp: In constructor …
warran
  • 184
  • 1
  • 10