[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

boost.python Event object wrapped with bp::object

Alexander Eisenhuth

2/13/2008 3:38:00 PM

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