Click here to Skip to main content
15,918,258 members

Comments by picardy (Top 2 by date)

picardy 19-Jul-10 15:19pm View    
How do I kick off a new task (using ThreadPool) each time a message arrives in the list? If I make the method static that should prevent more than one thread running (is this correct?).
The reason I don't want to use a Sleep(100) is because the List should empty as quickly as possible when data messages arrive.
Thanks for taking the tine to answer my question.
picardy 19-Jul-10 14:31pm View    
I have a component, myComponent, that receives data messages from other components, those data messages from other components are sent to myComponent.List so that they can be processed. myComponent.ProcessMessages method runs continuously in a loop processing all data messages in myComponent.List until the list is empty then sleeps for 100ms then checks the contents of the List again.

I want to remove the Sleep and only have myComponent.ProcessMessages invoked when data arrives in the list then stop when the list is empty, then restart when new data messages arrive in the list.