Thanks, that looks like what I need.
A question for the queue, the consumer in my program doesn't need first in-first out type of data from the producer, but rather the latest data produced, so I can't use Queue. Is it better to use local variable, global variable or something else? (for speed and memory consumption stand points)