10-10-2015 08:41 PM
In my consumer producer design, I have producer loop which is a GUI thread, and a consumer loop. Both are linked by a queue. The producer loop basically sends command and data to producer loop and then the producer loop will grab this data, do some processing and output to a string indicator.
Suppose there are 3 states A, B, C in consumer loop. Now I want to add state D which basically works as A → B → C → final data.
Without changing the way states A, B, C take in data, process data and output data. How can I design state D or if not possible, achieve the equivalency of state D ?
10-10-2015 10:12 PM
I think you have the words "consumer" and "producer" confused in parts of your post. When D is triggered, you could just queue up all three other states at once for sequential consumption..
10-10-2015 10:17 PM
For now I just put D in producer loop which gives data to state A, get the processed data, passed it on to B and so on.
I don't think it is possible to put similar code in consumer loop without modifying the way state A, B, C work (each state was given data and spit out processed data and nothing else). Am I wrong ?
10-10-2015 11:07 PM
Your descriptions is not specific enough to give much advice. can you show us some simplified code?
What do the states actually do?