The mutual exclusion classes of the Boost.Thread library are designed to serialize access to resources shared between C++ threads.
0
votes
1answer
14 views
creating scoped_lock for 200 ms max
I am trying to create a timed scoped lock on mutex. I thought following api from boost could help but I am having hard time finding some sample code as reference to use it.
scoped_lock(mutex_type ...
2
votes
2answers
51 views
Is there a boost equivalent to this “safe_read” call
I am new to boost threading (came from Win32 threading, which has probably ruined me).
So I'm trying to make a more "RAII" way to check that the working loop should still be going. So I made this ...
1
vote
1answer
49 views
Boost: Threading and mutexes in a functor
I'm trying something simple with threads and mutexes in C++ with boost.
This is the code:
#include <iostream>
#include <boost/thread/thread.hpp>
class mutex_test
{
private:
...
0
votes
1answer
64 views
can mutex hang execution?
I am fairly new to using mutexes seriously.
After implementing a few mutexes in various places, I realized that program execution hangs (not exit).
I tried to debug it (in eclipse environment) but I ...
0
votes
1answer
88 views
Is there anything Faster than a boost mutex for this code?
Currently in my code I have sections such as this
boost::mutex Mymutex
void methodA()
{
boost::mutex::scoped_lock lock(Mymutex);
......
......
......
}
I read that critical sections ...
1
vote
1answer
126 views
Segmentation fault by locking a mutex
I'm here to ask your opinion.
I'm new in a big project so I will try to describe the simple example as I see it.
The top backtrace is
#0 0xb6adfc6d in pthread_mutex_lock () from ...
0
votes
0answers
12 views
Synchronization issue
class Test
{
public:
Test()
{
_thread = new boost::thread(boost::bind(&Test::ScopedLockTest1, this));
_threadStartEvent.WaitForEvent(1000);
}
void ...
0
votes
1answer
68 views
Using boost::bind with a class containing a boost::mutex
I'm working on a server using a watchdir to add items to an internal collection. The watchdir is browsed periodically by a thread which is created like this :
this->watchDirThread = new ...
1
vote
1answer
272 views
Boost::thread mutex issue: Try to lock, access violation
I am currently learning how to multithread with c++, and for that im using boost::thread.
I'm using it for a simple gameengine, running three threads.
Two of the threads are reading and writing to ...
2
votes
1answer
208 views
How do I extend C++ boost list container to implement a thread safe implementation using boost upgrade mutex?
I wrote some sample test code to verify the functionality of using boost upgrade mutexes to implement a read/write mutex lock over a boost list container. I have ten threads, 5 are readers, 5 are ...
0
votes
0answers
133 views
heap corruption and mutex
I have a serious bug in an application, and I try to understand what is going on..
I have some logs just before the crash.
I can't reproduce the bug simply.
the context :
Thread1:
void f()
{
...
0
votes
3answers
461 views
multithreaded program producer/consumer [boost]
I'm playing with boost library and C++. I want to create a multithreaded program that contains a producer, conumer, and a stack. The procuder fills the stack, the consumer remove items (int) from the ...
0
votes
3answers
126 views
How do you share a mutex among different instances of a class?
I was wondering how to share a mutex in one class amongst different instances of another class.
Right now, I have a class, Indexer, that has a Boost mutex and condition_variable as private member ...
2
votes
1answer
330 views
Boost::mutex performance vs pthread_mutex_t
I was using pthread_mutex_ts beforehand. The code sometimes got stuck. I had a couple of lines of code scattered across functions that I wrapped...
pthread_mutex_lock(&map_mutex);// Line 1
...
0
votes
2answers
286 views
Using Boost mutex in two different classes
i am using boost mutex in MessageQueue class as a private member in the following method
void MessageQueue::Dequeuee()
{
Request rq(messageWareHouse.front().reqID,messageWareHouse.front().seq,
...
0
votes
1answer
117 views
boost-threads: How can I pass a scoped_lock to a callee?
I'm new to the boost threads library. I have a situation where I acquire a scoped_lock in one function and need to wait on it in a callee.
The code is on the lines of:
class HavingMutex
{
public:
...
3
votes
1answer
407 views
Boost::Mutex in class not thread-safe
I'm learning concurrent programming and what I want to do is have a class where each object it responsible for running its own Boost:Thread. I'm a little over my head with this code because it uses A ...
1
vote
1answer
300 views
Why not to use boost::mutex within shared memory compared to boost::interprocess_mutex?
Having now for a while been learning and using boost shared memory in anger I've arrived at a mental model, of when to use what type of mutex, that looks like this:
class ...
1
vote
0answers
252 views
boost::lock_guard waits forever
I'm developing a LRU-cache in C++, using boost mutexes and locks, in a multi-threaded environment.
The architecture is based on a boost::unordered_map + a lock-free-queue
Insertions work in ...
0
votes
5answers
512 views
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 ...
0
votes
1answer
259 views
Boost named_mutex unable to be shared across processes that are created by different users
I have a problem in sharing a boost named mutex across processes, which are created by different users.
The first process is created by service, which logon as LocalSystem.
The second process is ...
2
votes
2answers
296 views
vector copying and multi-threading : how to ensure multi-read even if occasional writes may happen?
Pseudocode:
Function1_vector_copy () {
vectora = vectorb;
}
Function2_vector_search() {
find k in vectora;
}
The program is multi-threaded. While many threads may search , vector copying is done ...
1
vote
1answer
682 views
Release boost::mutex from destructor
As std::vector isn't thread-safe, I was trying to build a very simple encapsulation around it which makes it thread-safe.
This works quite well, but there's one little problem.
When the instance of ...
1
vote
0answers
67 views
Access violation in custom serial server class in MSVC++ 6.0 using boost threads
I have an application that needs to be able to accept commands from the ethernet, serial port, and/or GUI, process them, and then output the results over the ethernet and serial channels. The host OS ...
4
votes
3answers
447 views
“Nested” scoped_lock
My shortened, simplified class looks as follows:
class A
{
public:
// ...
methodA();
methodB();
protected:
mutable boost::mutex m_mutex;
sometype* m_myVar;
}
...