I have a System (game) which I try to implement using the architecture Model-View-Presenter. What I have done right now is a while loop in the presenter that calls continuously the view methods for displaying. The way I do this is using a Producer/Consumer pattern, where the View register and event handler for touch events(Android) and produce the corresponding touch imstances, that the presenter consumes in the while loop.
Now I would like to use the pattern Observer/Suscriber between The Model and the Presenter. Using this the Presenter will be the Observer subscribe to changes on the state of the Model. The thing is, the presenter will execute the updates in the model, accordingly to the events occurred in the view. Every time that the presenter executes one method in.the model, It will be. possible to change its state and notify the presenter. I will separate then in another thread the model for every update, but how can I notify the presenter if this is running in a different thread inside a while loop? If I call the method notify observers, when the presenter will call the corresponding method?
Its driving me crazy! :P I need your help captains!