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
2 answers

boost::asio::async_write from outside class

If programming a tcp server using boost.asio using the example of the echo server , i have modified some of its codes to meet my requirements where i want to process the incoming data and send back the results, i used a class for socket handling…
Anwar Mohamed
  • 625
  • 2
  • 13
  • 27
0
votes
3 answers

poor performance with boost conditional mutex

I am new to using conditional_variables so I could easily be doing something stupid here but I am getting some odd performance when I use boost threads versus just calling the function directly. If I change the line that creates a boost thread on…
0
votes
2 answers

Boost: Two worker threads, sleep the main thread until they both finish

I have written a program using Boost threads. I have allocated two buffers (one for each of the worker threads) to store some info they are to process. They sit and wait for something to appear on the buffer, then they process it and place the…
NOP
  • 864
  • 1
  • 12
  • 26
0
votes
1 answer

C++ ReadConsoleInput not working with boost::thread

I've created to create a listener class that will call methods such as on_left_mouse_released on a controller object. It works fine, and now I am trying to have it run in another thread using boost::thread. However, I seem to be doing something…
Kvothe
  • 467
  • 4
  • 13
0
votes
1 answer

Boost.Thread timed wait

What happens to thread run under Windows OS, when the timeout occurs using boost::thread::timed_join, and the waiting thread finishes? Does the thread remain or it finishes along with the process?
Marc Andreson
  • 3,405
  • 5
  • 35
  • 51
0
votes
2 answers

how to make a threadpool with boost::thread

boost::thread is not-a-thread, a new thread is created when the ftor passed to it is called and thread exits when ftor returns. We use threadpool to minimize thread creation and destruction cost. but each thread in threadpool is also destroyed…
Dipro Sen
  • 4,350
  • 13
  • 37
  • 50
0
votes
2 answers

Need to mutex-protect (atomic) assignment sought by condition variable?

I understand how to use condition variables (crummy name for this construct, IMO, as the cv object neither is a variable nor indicates a condition). So I have a pair of threads, canonically set up with Boost.Thread as: bool awake =…
Mike C
  • 1,224
  • 10
  • 26
0
votes
2 answers

Synchronizing sleep and QTimer

I have two classes: class A and class B. In class A, I have a private slot Refresh which is called using QTimer every two seconds and helps in updating values in QTableView. Class B is defined by QThread and in run function I am taking data from the…
Mcolorz
  • 145
  • 1
  • 5
  • 20
0
votes
1 answer

Strange memory leak in C++ with Eigen and boost::thread

I have two threads running in a program. They are created using boost::thread. The two threads do not share anything in terms of memory. No data-structures or objects are shared between them. Now the second thread uses a class which has as private…
0
votes
1 answer

Boost Threads Producer/Consumer unexpected behavior

I am currently writing an application(using boost) that will have one producer grabbing frames and one consumer reading frames.I added a sleep statement in the producer to simulate the time to grab a frame. I expected the consumer to wait on a…
0
votes
2 answers

boost: thread not executing an handler posted after the reception of a signal

I am getting acquainted with boost thread and signals. I am thus implementing this simple example, I only post the cpp file of an example class implementing a thread capable of executing a method when a Signal1 is fired. The signal is defined within…
Andrea Sindico
  • 7,358
  • 6
  • 47
  • 84
0
votes
1 answer

Using boost::bind with a templated object

I want to pass to boost::bind a templated object, but g++ always yield an error. I have found how to pass a templated function, but is it possible to pass a templated object?. Here's the code. #include #include…
Adri C.S.
  • 2,909
  • 5
  • 36
  • 63
0
votes
0 answers

Segmentation fault using boost::thread

I've written an application using threads from boost::thread. It compiles and works fine on my local machine. Problem occurs on the one of the servers. I've send main.cpp file and compiled it the same way I did on my local machine: g++ -g main.cpp…
Daniel Gadawski
  • 1,893
  • 4
  • 20
  • 32
0
votes
2 answers

Boost.asio in Visual C++ Form project

I have successfully implemented a network application in visual CLR project using boost.asio. but when i tried to use the same code in windows form project with Common "Language Runtime Support (/clr)" which is recommended by boost.asio its not…
Navin
  • 554
  • 2
  • 9
  • 31
0
votes
1 answer

Running a boost thread as a Daemon

Is it possible to create a boost::thread and run it in the background (as a daemon)? I am trying to the following but my thread dies when main exits. /* * Create a simple function which writes to the console as a background thread. */ void…
Rajat
  • 467
  • 1
  • 5
  • 15