Multiple workitems running at the same time

Topics: CAB & Smart Client Software Factory
Dec 14, 2005 at 5:15 AM
originally posted by: jakkur

I have a situation where I need a workitem that performs a usecase (repeatedly until it is stopped explicitly) and creates a piece of data each time. I need another workitem that performs a different usecase (repeatedly until it is stopped explicitly) but uses the data created by the first workitem. I need these workitems running all the time independently. In other words, the first workitem can never stop what it was doing because the second one is active at any given time. In our current application, we accompish this using threads. Can we simulate this behaviour using workitems? Thanks also for any other suggestions.

Dec 14, 2005 at 7:46 AM
originally posted by: BradWilsonMSFT

No, WorkItems do not help you here.

My thinking is that you could create an object (whether that's a WorkItem or not is up to you), and within that object, spin off a thread to do the work just like before. When the work is complete, use EventBroker to signal between the worker and receiver. The receiver can request to get the event on the UI thread, if it's going to use the UI as a result of the work being done in the background.