Hi Everyone,
I was thinking of how to do this for a while now and I cant get my
head round it so I though I'd ask the experts! :-)
What I am doing is reading in large amounts of data over TCP and
saving it to disk. I receive alot of data from alot of clients so I do
all this without processing the data.
When a piece of data from a client has been completed I want to do
some processing on it and then send it off to another server. I want
to do all this in a low priority thread so as not to interfere with
the main program. What I would like to do is just add the job to a
queue and have a thread waiting ready to service the queue when a job
arrives. I may have 100 items on the queue or only 1. I just want this
thread to trundle away in the background pulling a job off the queue
processing it and then getting another job etc. If the queue is empty
then I would expect it to just sit there idle until an item is added.
Is this possible? How would I go about it or is there a better way?
Many thanks