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
5
votes
1 answer

What is the model of boost threading library

Which is the threading model of c++ boost threading library use ? 1:1 (Kernel-level threading) N:1 (User-level threading) M:N (Hybrid threading) The difference between these models (from wiki): http://en.wikipedia.org/wiki/Thread_(computing)#Models…
pgplus1628
  • 1,294
  • 1
  • 16
  • 22
5
votes
3 answers

Example of handling signals in multi-threaded process

Can anyone give me the steps or even the code for the following situation: A process which contains multiple thread, and of these threads is responsible of catching a user defined signal SIGUSR1. Only this thread should be capable of receiving this…
IoT
  • 607
  • 1
  • 11
  • 23
5
votes
2 answers

Using boost::thread_specific_ptr in a non-boost thread

I'm reading the documentation section for boost::thread_specific_ptr, and trying to parse this paragraph: Note: on some platforms, cleanup of thread-specific data is not performed for threads created with the platform's native API. On those…
5
votes
1 answer

C++ Symbol lookup error in shared library when accessing boost bind

I am trying to add multithreading into my library, so I am working on creating a thread executor for my library. For this I am using boost threads. This is the error I am getting when running a test case that links to the library: symbol lookup…
Jameshobbs
  • 524
  • 7
  • 17
5
votes
1 answer

How to make Boost dylibs universal (i386 & x86_64) on os x?

I'm trying to compile a Boost library into a universal binary file (i.e. a "fat" file that contains builds for both the i386 and x86_64 architectures). Souring the internet and SO I assembled the following instructions. Download boost (e.g. from…
dB'
  • 7,838
  • 15
  • 58
  • 101
5
votes
1 answer

Decimal value of: cout << dec << boost::this_thread::get_id()

Is it possible to cout thread::id in a decimal or octal format? std::cout << std::showbase; cout << dec(or oct) << boost::this_thread::get_id() I got always hex, for example 0xdf08.
Ivan Kush
  • 2,958
  • 2
  • 23
  • 39
5
votes
5 answers

Acquire lock as soon as it's available

I have two threads trying to lock the same boost::mutex. One of those threads is continuously processing some data, and the other is periodically displaying the current state. The processing thread, according to my intention, releases the lock very…
enobayram
  • 4,650
  • 23
  • 36
5
votes
1 answer

Bad Access in boost::future<>.then() after accessing given future

I'm developing for iOS in XCode 4.6. I'm writing a library for a service and use boost to start threads. One of my methods looks like this: void Service::start(boost::shared_ptr listener) { boost::future con =…
Stephan
  • 7,360
  • 37
  • 46
5
votes
1 answer

C++ multithreading today with a fluid situation for C++ 11 - book suggestions

After a lot of searching and a bit of tries and failures, i have summed up things and this are the results: C++ 11 threading model it's not ready yet for GCC ( based on g++ 4.7 ) or Clang ( from the latest svn rev. ) - ( the 2 most up-to-date…
user1849534
  • 2,329
  • 4
  • 18
  • 20
5
votes
1 answer

Linking Boost-Python Hello World

I am trying to compile and link boost-python hello world example and I have some linking problems. OS: Ubuntu g++ -fPIC -w Test2.cpp -I ../../../Libs/Python/Python-2.7.3/Include -I ../../../Libs/Python/Python-2.7.3 -I…
Roy
  • 65
  • 2
  • 15
  • 40
5
votes
2 answers

Creating boost::thread with an std::shared_ptr object instance

I have the following two code segments. The first block compiles and works as expected. However the second block does not compile. My question is, given the code below what is the correct syntax when trying to create a thread based on an instance…
Rikardo Koder
  • 672
  • 9
  • 16
5
votes
4 answers

BOOST threading : cout behavior

I am new to Boost threading and I am stuck with how output is performed from multiple threads. I have a simple boost::thread counting down from 9 to 1; the main thread waits and then prints "LiftOff..!!" #include #include…
Rajat
  • 467
  • 1
  • 5
  • 15
5
votes
1 answer

How to delete boost thread object when thread itself terminates?

When threads are added to boost::thread_group like: boost::thread_group my_threads; boost::thread *t = new boost::thread( &someFunc ); my_threads.add_thread(th); all the created boost::thread objects are deleted only when my_threads object is out…
Didar_Uranov
  • 1,230
  • 11
  • 26
4
votes
5 answers

Manually releasing boost locks?

For the sake of learning combinatorics of boost::thread I'm implementing a simple barrier (BR) for threads which lock a common mutex (M). However, as far as I get it when going to BR.wait() the locks on the mutex are not released, so in order for…
P Marecki
  • 1,108
  • 15
  • 19
4
votes
3 answers

Why might this thread management pattern result in a deadlock?

I'm using a common base class has_threads to manage any type that should be allowed to instantiate a boost::thread. Instances of has_threads each own a set of threads (to support waitAll and interruptAll functions, which I do not include below), and…
Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055