Click here to Skip to main content
12,892,796 members (62,840 online)

Pausing a collection of tasks, updating a datatable, resuming the collection of tasks

Frazer Mann asked:

Open original thread
Im trying to process data from my sql server in a chronological manner. The data is too large to fit into memory all at once so i have written a SProc which uses paging and returns X number of records.

To speed up the processing, i create a collection of X number of tasks and assign them different inputs. Each task is assigned different inputs, and they begin read/processing the datatable.

The following is where im stuck:

1)I need a way of pausing each task once it has finished reading all the data from the datatable.

2)Waiting until all the other tasks in the collection have finished reading the datatable.

3)Calling my SProc in order to load the next page of data into the datatable.

4)Recommence the tasks such that their local variable havent changed. ( i was planning to keep the results of each task in a local variable but if this isnt ideal im open to suggestions)
Tags: C# (C#4.0), multithreading, Task


When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100