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 class there:
http://taf.codeplex.com/SourceControl/changeset/view/31767#511225
The main imp...
Is there a way to automatically lock an STL container on access, without having to lock and release around it?
...
I have a worker class like the one below:
class Worker{
public:
int Do(){
int ret = 100;
// do stuff
return ret;
}
}
It's intended to be executed with boost::thread and boost::bind, like:
Worker worker;
boost::function<int()> th_func = boost::bind(&Worker::Do, &worker);
boost::thread th(th_func);
th.join();
My quest...
Hi,
How does the Boost Thread libraries compare against the java.util.concurrent libraries?
Performance is critical and so I would prefer to stay with C++ (although Java is a lot faster these days). Given that I have to code in C++, what libraries exist to make threading easy and less error prone.
I have heard recently that as of JDK...
Hi,
I've got this test case here that compiles with g++ theFile.cc -lboost_thread.
When running the program it seems to be hanging at the join command. I'm not exactly sure why. It's like the interrupt_point() function isn't getting the join request from the main thread.
#include <iostream>
#include <stdio.h>
#include <signal.h>
#inclu...
Hi,
I am currently working on a small wrapper class for boost thread but I dont really get how the sleep function works, this is what I have got so far:
BaseThread::BaseThread(){
thread = boost::thread();
bIsActive = true;
}
BaseThread::~BaseThread(){
join();
}
void BaseThread::join(){
thread.join();
}
void BaseT...
I have an application that creates a job queue, and then multiple threads execute the jobs. By execute them, I mean they call system() with the job string.
The problem is that output to stdout looks like the output at the bottom of the question. I would like each application run to be separated, so the output would look like:
flac 1.2...
I am currently developing new features for an existing VCL application. The application creates charts and static images using a thirdparty package called TeeChart.
There is one instance where I have to load in 2 million data points to create a static image chart. However, this takes a while to load and the user can't do anything in the ...
I compiled the Boost C++ libraries as follows:
bjam install variant=release link=static threading=multi runtime-link=static
No errors. Then I compiled the following source:
#include <boost/thread/thread.hpp>
#include <iostream>
#define BOOST_THREAD_NO_LIB
void hello() {
std::cout << "Hello world, I'm a thread!" << std::endl;
}
i...
I have a program that brings up and tears down multiple threads throughout its life. Everything works great for awhile, but eventually, I get the following core dump stack trace.
#0 0x009887a2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
#1 0x007617a5 in raise () from /lib/tls/libc.so.6
#2 0x00763209 in abort () from /lib/tls/lib...
I have a class that is shared between several projects, some uses of it are single-threaded and some are multi-threaded. The single-threaded users don't want the overhead of mutex locking, and the multi-threaded users don't want to do their own locking and want to be able to optionally run in "single-threaded mode." So I would like to ...
I am using Netbeans to build a java web project (tomcat 6.02 based) which loads a c++ native dll. I am using Jace library which wraps JNI.
In my java code I have a static callback function which I call from c++ code. I am trying to invoke this callback in a new thread using boost.Thread but tomcat just dies without any message or crash ...
I am porting some code from windows to Linux (Ubuntu 9.10). I have a simple class (please see below), which uses windows functions to implement simple mutex locking. I want to use Boost.Threads to reimplement this, but that library is new to me.
Can someone point out the changes I need to make to the class below, in order tomuse Boost.T...
Hi,
I have the following situation:
I create a boost::thread_group instance, then create threads for parallel-processing on some data, then join_all on the threads.
Initially I created the threads for every X elements of data, like so:
// begin = someVector.begin();
// end = someVector.end();
// batchDispatcher = boost::function<void...
From Boost::Thread:
template <typename R>
class shared_future
{
...
// move support
shared_future(shared_future && other);
shared_future(unique_future<R> && other);
shared_future& operator=(shared_future && other);
shared_future& operator=(unique_future<R> && other);
...
}
What on earth are those double-ampersands ? I went over "BS Th...
I have a threadSafe method that gets called by multiple threads. Is there a way to know which thread called it?
...
I'm using the Scintilla edit control on Windows (Win32, C/C++) . The control is created in WndProc. I have a second thread, created with Boost.Thread, that act as a spell checker and marks with red squiggle incorrectly spelled words. Therefore, I have two threads altering the content of the Scintilla control.
At first, the program was ...
I have a list of items that I need to update on different intervals. The list can grow to be thousands of items long. Each item could potentially have a different interval. If I create one timer per item, am I going to saturate the system with threads? I was thinking it might be better to create one timer equal to the smallest interval i...
Hey all -
I'm writing an MPI program (Visual Studio 2k8 + MSMPI) that uses Boost::thread to spawn two threads per MPI process, and have run into a problem I'm having trouble tracking down.
When I run the program with: mpiexec -n 2 program.exe, one of the processes suddenly terminates:
job aborted:
[ranks] message
[0] terminated
[1] ...
I'm working on a library doing audio encoding/decoding. The encoder shall be able to use multiple cores (i.e. multiple threads, using boost library), if available. What i have right now is a class that performs all encoding-relevant operations.
The next step i want to take is to make that class threaded. So i'm wondering how to do this....