Parse() public method

Parses the feed.
public Parse ( ) : bool
return bool
Ejemplo n.º 1
0
        static void ThreadPoolTask(object data)
        {
            var f = new FeedParser(((ThreadPoolDataWrapper) data).FeedSource);
            f.Parse();
            var threadPoolDataWrapper = data as ThreadPoolDataWrapper;

            if (threadPoolDataWrapper != null) 
                threadPoolDataWrapper.ResetEvent.Set();
        }
Ejemplo n.º 2
0
        private static TimeSpan MeasureParallelForeach(IEnumerable<string> feedSources)
        {
            var stopwatch = new Stopwatch();
            stopwatch.Start();

            Parallel.ForEach(feedSources, feedSource =>
                {
                    var f = new FeedParser(feedSource);
                    f.Parse();
                }
            );

            stopwatch.Stop();
            return stopwatch.Elapsed;
        }
Ejemplo n.º 3
0
 private static void TPLFeedParserTask(string feedSource)
 {
     var f = new FeedParser(feedSource);
     f.Parse();
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Measures threaded version.
        /// </summary>
        /// <param name="feedSources"></param>
        /// <returns></returns>
		private static TimeSpan MeasureThreads(IList<string> feedSources)
		{
            var stopwatch = new Stopwatch();
            stopwatch.Start();

			var threads = new Thread[feedSources.Count];

			for (var i = 0; i < feedSources.Count; i++)
			{
                var source = feedSources[i]; /* work-around modified closures */
				var feedParser = new FeedParser(source);
				threads[i] = new Thread(() => feedParser.Parse());
				threads[i].Start();
			}

			foreach (var thread in threads)
			{
				thread.Join();
			}

            stopwatch.Stop();
            return stopwatch.Elapsed;            
		}