Threading start back again after pausing
===

I am using threading in my code , thread are created using function:

     private void InitializeBackgoundWorkers()
        {
            
            for (int f = 0; f < maxThreads; f++)
            {
                listBox1.Items.Insert(0, "Starting Thread : " + (f + 1));
                threadArray[f] = new BackgroundWorker();
                threadArray[f].DoWork +=
                    new DoWorkEventHandler(backgroundWorkerFiles_DoWork);
                threadArray[f].RunWorkerCompleted +=
                    new RunWorkerCompletedEventHandler(backgroundWorkerFiles_RunWorkerCompleted);
                threadArray[f].ProgressChanged +=
                    new ProgressChangedEventHandler(backgroundWorkerFiles_ProgressChanged);
                threadArray[f].WorkerReportsProgress = true;
                threadArray[f].WorkerSupportsCancellation = true;

            }
        }


And the doevent is something like :

     private void backgroundWorkerFiles_DoWork(object sender, DoWorkEventArgs e)
        {

            BackgroundWorker worker = sender as BackgroundWorker;

             int flag = 0;

            while (rowCounter < allPostingRows.Tables[0].Rows.Count && flag==0)
            {
               
                for (int i = 0; i < maxThreads; i++)
                {

                    if (threadArray[i].CancellationPending == true)
                    {
                        flag = 1;
                        threadArray[i].CancelAsync();
                        worker.ReportProgress(0, "Thread Paused:");
                    }

                }

                if (flag == 0)
                {
                    worker.ReportProgress(0, "Running Row  :" + rowCounter + " FROM DATABASE!");
                    string userName = string.Empty;
                    string pass = string.Empty;
                    string status = string.Empty;


                    string postTitle = string.Empty;
                    string postText = string.Empty;
                    string ContentImage = string.Empty;
                    string postUrl = string.Empty;
                    string postTxtSnippet = string.Empty;
                    string groupID = string.Empty;
                    string postON = string.Empty;
                    int dbID = 0;
                    string groupUrl = string.Empty;

                    string groupName = string.Empty;

                    dbID = Convert.ToInt16(allPostingRows.Tables[0].Rows[rowCounter]["ID"].ToString());
                    groupName = allPostingRows.Tables[0].Rows[rowCounter]["groupname"].ToString();
                    groupUrl = allPostingRows.Tables[0].Rows[rowCounter]["groupurl"].ToString();
                    userName = allPostingRows.Tables[0].Rows[rowCounter]["acctusername"].ToString();
                    pass = allPostingRows.Tables[0].Rows[rowCounter]["acctpassword"].ToString();
                    //   status = allPostingRows.Tables[0].Rows[rowCounter]["messageurl"].ToString();

                    groupID = allPostingRows.Tables[0].Rows[rowCounter]["groupURL"].ToString();

                    if (groupID.Contains("gid="))
                    {
                        groupID = groupID.Remove(0, groupID.IndexOf("gid=")).Replace("gid=", "");

                        if (groupID.Contains("&"))
                        {
                            groupID = groupID.Remove(groupID.IndexOf("&")).Trim();
                        }
                    }
                    postTitle = allPostingRows.Tables[0].Rows[rowCounter]["messageTitle"].ToString();
                    postText = allPostingRows.Tables[0].Rows[rowCounter]["messagePostText"].ToString();
                    postUrl = allPostingRows.Tables[0].Rows[rowCounter]["messageurl"].ToString();
                    postTxtSnippet = allPostingRows.Tables[0].Rows[rowCounter]["messagetxtsnippet"].ToString();
                    postON = allPostingRows.Tables[0].Rows[rowCounter]["PostMessageON"].ToString();

                    //     postUrl = "http://www.bbc.com";

                    if (postTitle.Contains("|") && postTitle.Contains("{"))
                    {
                        Random RAND = new Random();
                        postTitle = spintax(RAND, postTitle);
                    }
                    if (postText.Contains("|") && postText.Contains("{"))
                    {
                        Random RAND = new Random();
                        postText = spintax(RAND, postText);
                    }

                    if (postTxtSnippet.Contains("|") && postTxtSnippet.Contains("{"))
                    {
                        Random RAND = new Random();
                        postTxtSnippet = spintax(RAND, postTxtSnippet);
                    }

                    worker.ReportProgress(0, "Posting =" + postUrl);


                    rowCounter = rowCounter + 1;

                    postFunction(userName, pass, postUrl, rowCounter, worker, postTitle, postText, postTxtSnippet, groupID, dbID, postON, groupName, groupUrl);

                    worker.ReportProgress(0, "Message POSTED =" + status);
                    totalRowsinCampaigns = totalRowsinCampaigns - rowCounter;
                }
            }
            
           
             
        }

And on button i try to cancel the threads using:

      for (int i = 0; i < maxThreads; i++)
            {

                

                threadArray[i].CancelAsync();
                
            }



Is all my code good? As when the thread stops i see them pausing/stopping they start again after some time within second?

Thank you