Gybe
Gybe

Reputation: 329

Building a GUI on top of a Concurrent Application?

I'm wondering what the best practices are for this sort of situation:

I am emulating an Elevator system that is currently just dumping all output to the console. This is not easy to track and it's hard to visualize the state of the ques on each floor and how efficient the current algorithm is. The setup is as follows:

A Person Producer/Consumer pair creates randomized people and places them on each floor with a specific destination. Each floor contains ques for people going up and going down. The elevators interact with each floor and a scheduler to decide where to go next and who to pickup.

In representing this setup as a gui what is the best approach at translating the current state of each thread/object into the gui?

Edit: Should I be looking at firing off events anytime an object changes state enough for a change to be reflected in the gui?

Upvotes: 2

Views: 148

Answers (1)

prmottajr
prmottajr

Reputation: 1824

Just have your threads for the elevators/people running and updating your main data structures and then on the drawing method of your gui you will go through your data structure and draw everything on the screen.

Upvotes: 1

Related Questions