I just recently installed and built boost library (1.34.1) using
bcbboost. I wanted to try the boost::thread class. This simple
code gives me "Access Violation" in Borland C++ Builder 2006 when
boost::mutex is
used:
//--------------------------------------------------------------------------
-
#include <iostream>
#include
(this=:0012FEA4, lock=:0012FE5C) :0041D42F __UNNS__thread_01c827c2c2c9169a::thread_param::wait(this=:0012FE9C) :0041D201 boost::thread::thread(this=:00000FCC, threadfunc=:00000FC8) :00000001 :0012fe01
I put mutex.cpp in my directory and BCB2006 locates the error to be here: void mutex::do_unlock() { if (m_critical_section) //------------- Access violation HERE release_critical_section(m_mutex); else release_mutex(m_mutex); } The access violation is raised when thread::thread constructor is called. Looking at the caller stack I noticed that mutex parameter is NULL from some point and it results in this==NULL for the last call. Note that this mutex parameter is not the mutex "console" object I use in the program. It is a mutex that boost.threads library uses during thread initialization. On the other hand there is some dependance on mutex "console" because when I comment it out the error is gone. I maked console a pointer with appropriate changes to source and created it using new but it did not help. Am I missing something? Any help appreciated. Does anybody have experiences with boost::thread and mutex under BCB(2006,2007...)? Vaclav