I don't really know much about C++ threading, the Boost APIs or even STL. So I don't yet see the fundamental flaw in this event loop:
while(true){
if(!_eventList.empty()){
boost::mutex::scoped_lock alock(_mutex);/*Yes Charlweed, lock is an INSTANCE.*/
for(eventIterator =_eventList.begin();eventIterator != _eventList.end();eventIterator++){
/* pop the event off of the queue */
queuedEvent = &(*eventIterator);// This line really bugs me.
//processEvent(queuedEvent,javaThreadEnv,theUpperDeck);
}
_eventList.clear();
}
}
It does not work at all. Because this is running on a separate thread, I want it to flow forever, PAUSING only when it cannot get a lock on the mutex. I'm not sure what is really happening, but it looks like the other thread blocks permanently after the _eventList gains an item.
Dang.
No comments:
Post a Comment