[C++-sig] bosst.python Event object wrapped with bp::object()

Alexander Eisenhuth newsuser at stacom-software.de
Wed Feb 13 11:05:47 CET 2008


Hello everybody,

I Use a C++ thread that is called from the python sides to provoke some 
activities. The calls set some booleans in the thread object and return. To 
synchrThreadClassonize the execution in the thread, the idea of me is, to give a 
Python Event() object as bp::object to the C++ thread, that calls the python 
"set" attribute after the related activity has finished. Maybe this code is clearer:

Python:
thread = wrapper.ThreadClass()
event = Event()
thread.methode(event)
event.wait()


C++:
ThreadClass::methode(bp::object event)
{
	this->myEvent = event
	...
	methodeCalled = true
	...
}

ThreadClass::threadLoop()
{
	...
	if (methodeCalled) {
		...
		this->myEvent.attr("set")();
	}

}

The application crashes. If I comment out event.wait() it doesn't crash.

Any suggestions or experiances?

Thanks a lot
Alexander




More information about the Cplusplus-sig mailing list