Two worker threads using one queue

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ralph Wiggum

    Two worker threads using one queue

    I'm planning on pulling data from a webservice and push the data on to a buffer/queue for each response. This should happen in a thread, while another thread parses the data (heavy) and writes them to disk. Time is of the essence, so the goal is to run the webservice requests parallel to processing data in the queue.

    Do you have any tips on how to "drive" this? Can I put pop/push event handlers on the queue, event handlers on webservice responses or event handlers on complete disk operations? All of the above? Will I need polling to check if the disk operation is done or other types of waiting mechanisms? I don't like polling... What about thread safety and the queue? Some sort of locking technique is required?

    Any tips, links to examples etc. will be much appreciated.
  • Gunga Din

    #2
    Re: Two worker threads using one queue


    "Ralph Wiggum" <go.ahead@spam. mewrote in message
    news:SsOdnW69T-A35y7aRVnzvQA@t elenor.com...
    I'm planning on pulling data from a webservice and push the data on to a
    buffer/queue for each response. This should happen in a thread, while
    another thread parses the data (heavy) and writes them to disk. Time is of
    the essence, so the goal is to run the webservice requests parallel to
    processing data in the queue.
    Do you have any tips on how to "drive" this? Can I put pop/push event
    handlers on the queue, event handlers on webservice responses or event
    handlers on complete disk operations? All of the above? Will I need
    polling to check if the disk operation is done or other types of waiting
    mechanisms? I don't like polling... What about thread safety and the
    queue? Some sort of locking technique is required?
    >
    Any tips, links to examples etc. will be much appreciated.

    There's a producer/consumer power point along with c# source of a working
    program at http://www.tyburn-consultancy.co.uk


    Comment

    Working...