You are running python in multiple threads at the same time in Producer::run()and Consumer::run().
, :
boost::python::object writer = this->k->Get<boost::python::object>("write");
, , Boost PyObject_GetItem, boost::python::object::operator[](const std::string&) Keeper::Get. Get-call , :
{
boost::mutex::scoped_lock l(this->k->python_keeper);
boost::python::object writer = this->k->Get<boost::python::object>("write");
writer(boost::python::str(os.str()));
}
: Py_Finalize(). , , boost.python .