Click here to Skip to main content
15,881,644 members
Home / Discussions / C#
   

C#

 
AnswerRe: Fill DataGridView In Visual Studio 2010 Pin
madhubsu@gmail.com5-Aug-13 2:17
madhubsu@gmail.com5-Aug-13 2:17 
Questioncomputerized system of checking a multiple choice question exam using c# Pin
xtin901-Aug-13 17:59
xtin901-Aug-13 17:59 
AnswerRe: computerized system of checking a multiple choice question exam using c# Pin
Richard Andrew x641-Aug-13 18:19
professionalRichard Andrew x641-Aug-13 18:19 
GeneralRe: computerized system of checking a multiple choice question exam using c# Pin
xtin901-Aug-13 18:54
xtin901-Aug-13 18:54 
GeneralRe: computerized system of checking a multiple choice question exam using c# Pin
Dave Kreskowiak2-Aug-13 2:27
mveDave Kreskowiak2-Aug-13 2:27 
GeneralRe: computerized system of checking a multiple choice question exam using c# Pin
xtin902-Aug-13 4:27
xtin902-Aug-13 4:27 
GeneralRe: computerized system of checking a multiple choice question exam using c# Pin
Dave Kreskowiak2-Aug-13 4:48
mveDave Kreskowiak2-Aug-13 4:48 
QuestionMulti-threaded Task stops after 150 tasks Pin
MAW301-Aug-13 14:50
MAW301-Aug-13 14:50 
I used the following code for multi-threading, The code works fine but much slower if I add the tasks[nData].wait() command see below "*****" but if I remove the tasks[nData].wait() command then the code generates all the task but only gathers information for approximately 150 task then stops. Can anyone tell me why this is happening and what I can do to correct this problem.

Any help will be greatly appreciated.
Michael



public Boolean LoadData()
        {
            Boolean bComplete = false;
            Int32 nTotalData = 10000;
            this.tasks = new Task[nTotalData];
            DateTime dtStartTime = DateTime.Now;

            ProcessingBarsCS.StartTime();
            var parent = Task.Factory.StartNew(() =>
            {
                dtStartTime = DateTime.Now;

                for (Int32 nData = 0; nData < nTotalSymbols; nData++)
                {
                    bComplete = GetData_Task(nData, dtStartTime, nTotalData);
                }
            });
            parent.Wait();
            ProcessingBarsCS.StopTime();

            return bComplete;
        }

        Boolean GetData_Task(Int32 nData, DateTime  dtStartTime, Int32 nTotalData)
        {
            DataCS dataCS = new DataCS();
            tasks[nData] = Task.Factory.StartNew(() =>
            {
                nData = dataCS.Data();
            })
                .ContinueWith(antecendent => ProcessingData(nData));

            // *****
            tasks[nData].Wait();

            // Wait for all task to finish calculations
            try
            {
                Task.WaitAll(tasks);
                SetData_ElapsedTime(dtStartTime, nTotalData);
            }
            catch { }

            return true;
        }

AnswerRe: Multi-threaded Task stops after 150 tasks Pin
walterhevedeich1-Aug-13 19:59
professionalwalterhevedeich1-Aug-13 19:59 
AnswerRe: Multi-threaded Task stops after 150 tasks Pin
Richard Deeming2-Aug-13 1:19
mveRichard Deeming2-Aug-13 1:19 
QuestionFileSyncProvider Exception sourceDirectory is write protected Pin
andre_muc1-Aug-13 9:27
andre_muc1-Aug-13 9:27 
QuestionWindows Service Pin
murugesan.ks1-Aug-13 7:55
murugesan.ks1-Aug-13 7:55 
AnswerRe: Windows Service Pin
Eddy Vluggen1-Aug-13 9:02
professionalEddy Vluggen1-Aug-13 9:02 
AnswerRe: Windows Service Pin
jschell1-Aug-13 11:29
jschell1-Aug-13 11:29 
QuestionFill Data One Grid To Another Grid using Arrow Key Pin
sanket1641-Aug-13 2:32
sanket1641-Aug-13 2:32 
AnswerRe: Fill Data One Grid To Another Grid using Arrow Key Pin
Dave Kreskowiak1-Aug-13 3:30
mveDave Kreskowiak1-Aug-13 3:30 
Questionsend SOAP message using web service Pin
vaibhavData1-Aug-13 0:27
vaibhavData1-Aug-13 0:27 
AnswerRe: send SOAP message using web service Pin
Richard Andrew x641-Aug-13 11:14
professionalRichard Andrew x641-Aug-13 11:14 
GeneralRe: send SOAP message using web service Pin
vaibhavData1-Aug-13 19:05
vaibhavData1-Aug-13 19:05 
QuestionMemory management Pin
sureshdob1-Aug-13 0:11
sureshdob1-Aug-13 0:11 
AnswerRe: Memory management Pin
Eddy Vluggen1-Aug-13 1:05
professionalEddy Vluggen1-Aug-13 1:05 
QuestionGradient arc Pin
FaraonKture31-Jul-13 21:30
FaraonKture31-Jul-13 21:30 
AnswerRe: Gradient arc Pin
Pete O'Hanlon31-Jul-13 22:22
mvePete O'Hanlon31-Jul-13 22:22 
AnswerRe: Gradient arc Pin
Abhinav S31-Jul-13 22:35
Abhinav S31-Jul-13 22:35 
QuestionWMI with service application Pin
Andre O Rahming31-Jul-13 12:37
Andre O Rahming31-Jul-13 12:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.