in reply to Using threads::shared with multidimensional arrays

Would you consider a different approach? Use a stricter separation of model, view, and controller where each socket thread only gets and sends view information and uses message passing to update the view. That is, instead of updating a shared data structure, send a message (perhaps just by pushing onto a simple queue) to the model describing the move in terms of what the player has requested.

I've used this before to allow very different input forms... it's pretty flexible and keeps things clean.

  • Comment on Re: Using threads::shared with multidimensional arrays

Replies are listed 'Best First'.
Many thanks
by Anonymous Monk on Jun 12, 2006 at 12:23 UTC
    First off, thanks very much for the help! I was shocked to have so many responses so quickly. (I'm a new member.) I would definitely consider a different method, chromatic, but I'm unclear on the method you're describing. Would I share the array containing the list of moves and create a thread to constantly check it, redrawing the map when its length had changed? Thanks again, Monks.