How to make values transfer between multiple threads

I have two threads:

Thread 1 is fetching XML from a web service in loop.

Thread 2 is parsing the XML fetched by thread 1 and showing it in the UI.

Please tell me what is the best way to pass XML data from thread 1 to thread 2 as it’s retrieved by thread 1?

Thread 1 is fetching the XML and then thread 2 consuming it.

To do so i have created a circular linked list and thread 1 puts its XML there in the linked list and thread 2 gets the XML for it and remove it from the list, and it’s working fine.

Please tell me if there is any other better approach than what I am using.

Answers


Looks like you need

Producer-Consumer Quequ


The framework provides

ConcurrentQueue

with .NET 4.0. It should implement a queue between consumer and producer without the need of any manual synchronisation.


Need Your Help

Where does model manipulation logic go in AngularJS?

angularjs angularjs-scope

I'm building an application that fetches calendar data via an AJAX call at the $rootScope. I use this object in various controllers, and I need to be able to parse it appropriately, as there are va...

Symfony2 Flash Message Not Cleared

session symfony2 flash-message

I'm trying for the first time to set and then display a flash message in a Symfony2 application. A flash message being set is not cleared once displayed for the first time.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.