Click here to Skip to main content
15,511,378 members
Home / Discussions / C#
   

C#

 
AnswerRe: Fill DataGridView In Visual Studio 2010 Pin
madhubsu@gmail.com5-Aug-13 3:17
madhubsu@gmail.com5-Aug-13 3:17 
Questioncomputerized system of checking a multiple choice question exam using c# Pin
xtin901-Aug-13 18:59
xtin901-Aug-13 18:59 
AnswerRe: computerized system of checking a multiple choice question exam using c# Pin
Richard Andrew x641-Aug-13 19:19
professionalRichard Andrew x641-Aug-13 19:19 
GeneralRe: computerized system of checking a multiple choice question exam using c# Pin
xtin901-Aug-13 19:54
xtin901-Aug-13 19:54 
GeneralRe: computerized system of checking a multiple choice question exam using c# Pin
Dave Kreskowiak2-Aug-13 3:27
mveDave Kreskowiak2-Aug-13 3:27 
GeneralRe: computerized system of checking a multiple choice question exam using c# Pin
xtin902-Aug-13 5:27
xtin902-Aug-13 5:27 
GeneralRe: computerized system of checking a multiple choice question exam using c# Pin
Dave Kreskowiak2-Aug-13 5:48
mveDave Kreskowiak2-Aug-13 5:48 
QuestionMulti-threaded Task stops after 150 tasks Pin
MAW301-Aug-13 15:50
MAW301-Aug-13 15: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 20:59
professionalwalterhevedeich1-Aug-13 20:59 
AnswerRe: Multi-threaded Task stops after 150 tasks Pin
Richard Deeming2-Aug-13 2:19
mveRichard Deeming2-Aug-13 2:19 
QuestionFileSyncProvider Exception sourceDirectory is write protected Pin
andre_muc1-Aug-13 10:27
andre_muc1-Aug-13 10:27 
QuestionWindows Service Pin
murugesan.ks1-Aug-13 8:55
murugesan.ks1-Aug-13 8:55 
AnswerRe: Windows Service Pin
Eddy Vluggen1-Aug-13 10:02
professionalEddy Vluggen1-Aug-13 10:02 
AnswerRe: Windows Service Pin
jschell1-Aug-13 12:29
jschell1-Aug-13 12:29 
QuestionFill Data One Grid To Another Grid using Arrow Key Pin
sanket1641-Aug-13 3:32
sanket1641-Aug-13 3:32 
AnswerRe: Fill Data One Grid To Another Grid using Arrow Key Pin
Dave Kreskowiak1-Aug-13 4:30
mveDave Kreskowiak1-Aug-13 4:30 
Questionsend SOAP message using web service Pin
vaibhavData1-Aug-13 1:27
vaibhavData1-Aug-13 1:27 
AnswerRe: send SOAP message using web service Pin
Richard Andrew x641-Aug-13 12:14
professionalRichard Andrew x641-Aug-13 12:14 
GeneralRe: send SOAP message using web service Pin
vaibhavData1-Aug-13 20:05
vaibhavData1-Aug-13 20:05 
QuestionMemory management Pin
sureshdob1-Aug-13 1:11
sureshdob1-Aug-13 1:11 
AnswerRe: Memory management Pin
Eddy Vluggen1-Aug-13 2:05
professionalEddy Vluggen1-Aug-13 2:05 
QuestionGradient arc Pin
FaraonKture31-Jul-13 22:30
FaraonKture31-Jul-13 22:30 
AnswerRe: Gradient arc Pin
Pete O'Hanlon31-Jul-13 23:22
mvaPete O'Hanlon31-Jul-13 23:22 
AnswerRe: Gradient arc Pin
Abhinav S31-Jul-13 23:35
Abhinav S31-Jul-13 23:35 
QuestionWMI with service application Pin
Andre O Rahming31-Jul-13 13:37
Andre O Rahming31-Jul-13 13: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.