Wednesday, 7 August 2013

What could cause an Access Violation writing location with boost::lock_guard

What could cause an Access Violation writing location with boost::lock_guard

I currently have something like this in my code
boost::mutex mutex_s;
boost::condition_variable condition_c;
void SomeClass::Dumper(mobj* lfeedTuple)
{
try
{
{
boost::lock_guard<boost::mutex> lock(mutex_s); //Error
m_container.push_back(lfeedTuple);
}
condition_c.notify_one();
}
catch (std::exception& e)
{
__debugbreak();
}
}
However sometimes I would get the error on the statement:
boost::lock_guard<boost::mutex> lock(mutex_s);
The error would be
Unhandled exception at 0x0050ad29 in Test.exe: 0xC0000005: Access
violation writing location 0x7d353764.and the stack trace would end up at:
// thread_primitives.hpp
inline bool interlocked_bit_test_and_set(long* x,long bit)
{
return _interlockedbittestandset(x,bit)!=0; // (break stops here)
}
any suggestions on what might be going wrong?

No comments:

Post a Comment