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

copy to a list, pool, set of threads (1:n) / each thread local storage

I'm currently exploring boost::thread/threadpool and thread local storage basically to achieve a copy of one datagram to the job-queues for a pool of threads. The current setup uses a 1:1 setup to copy loosely coupled one datagram from one thread…
Hhut
  • 1,128
  • 1
  • 12
  • 24
0
votes
1 answer

Cannot use boost::threads in Visual Studio 2012

I get the following error using boost::threads in visual studio 2012 (CTP Nov 2012). I'm using boost 1.53. 1>boost/config/requires_threads.hpp(29): fatal error C1189: #error : "Threading support unavaliable: it has been explicitly disabled with…
Zendel
  • 485
  • 3
  • 14
0
votes
1 answer

WT widget not updating in boost thread

I have run into an interesting problem with WT, I have solved it, but I do not understand WHY my solution solved the problem. I've dug through WT documentation for the widgets and have come up empty handed so far, so maybe someone who knows more…
user2115945
  • 223
  • 3
  • 12
0
votes
1 answer

Boost thread interrupted when qt crashes

I have a qt application with a few boost threads running. When I get an unhandled exception (ex. std::runtime_error) in one of my qt event handlers, the boost threads also catch thread_interrupted exceptions. Why does this happen? I already have try…
Arno Duvenhage
  • 1,910
  • 17
  • 36
0
votes
1 answer

'boost shared_ptr' and 'boost lock' together = messed up

I am new to both concepts shared_ptr and mutex (boost or not boost). I am trying to use it in my classes : typedef boost::shared_mutex Lock; typedef boost::unique_lock< Lock > WriteLock; typedef boost::shared_lock< Lock > ReadLock; class…
rahman
  • 4,820
  • 16
  • 52
  • 86
0
votes
1 answer

timed_join(0) : no operator found which takes a right-hand operand of type 'const int'

I tried to check if a thread is running with use of timed_join(0). But unlike others, I get this error: 1>c:...\boost\thread\detail\thread.hpp(538): error C2679: binary '+' : no operator found which takes a right-hand operand of type 'const int'…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
0
votes
1 answer

boost thread bad access in Xcode

UPDATE: if i use libc++ to compile, then I'm getting the error but when I change the compiler to libstdc++ (GNU C++ standard library), the program will run without showing any errors. I'm trying out some sample codes from the boost website and…
Robert
  • 57
  • 1
  • 8
0
votes
1 answer

Boost bind object freed on read handler

I am using Boost asio to open several sockets I use a collection with shared pointers to a custom class with all that socket info. This class also has the handle_read function for async_receive as I need to do different things with each receive and…
frisco
  • 1,897
  • 2
  • 21
  • 29
0
votes
1 answer

Memory leak caused by a wrong usage of scoped_lock?

I have a memory leak, and I guess it's caused by a wrong usage of scoped_lock (Boost). I however don't manage to find the exact problem, and I do believe that the way the code has been written is not completely right neither. The code is in this…
TigrouMeow
  • 3,669
  • 3
  • 27
  • 31
0
votes
1 answer

Launch method in new thread

I have a vector with pointers of objects and I'm trying to launch object's method in a new thread (method have a parameter). This is code, which I can't compile: class CanaSynchDynamic { ... void start() (boost::barrier&); ... }; and in…
torm
  • 1,486
  • 15
  • 25
0
votes
1 answer

ofstream write from multiple boost threads - g++ and vs2008

Using the boost thread library I pass the open ofstream file to each thread as a reference, after half the threads write there is some kind of crash and the program terminates. My assumption is the function reaches the end, closes the file and the…
forest.peterson
  • 755
  • 2
  • 13
  • 30
0
votes
1 answer

How to integrate boost thread(source files) into my own project

What I want is to put the source files about the boost thread(all necessary header and source files) into my own project so that other people don't need to configure the support of boost anymore. The build system is made by CMake. Recently I am…
Vulcann
  • 177
  • 12
0
votes
4 answers

Can a thread be reused to run variadic functions?

I am trying to create a boost thread in C++ that can be reused to run a variety of functions that can have different number and type of args. Can this be done with C++11x variadics? In my use case I do not need a queue (if the thread is busy then…
0
votes
2 answers

Boost thread won't increase the value correctly

So, I have this code that doesn't seem to work: (more details below) #include #include #include using namespace std; boost::mutex m1,m2; void * incr1(int thr, int& count) { for (;;) { …
William Northern
  • 403
  • 2
  • 5
  • 12
0
votes
1 answer

How to use boost::lambda to create new object for an existing pointer?

What I want to do is --> create a new object in a new thread. Something like: Class* object = 0; Arg arg; boost::thread t( lambda::bind( object = lambda::new_ptr< Class >()( boost::ref( arg ) ); it doesn't compile, what's correct way?
JQ.
  • 678
  • 7
  • 17