The thread execution sequence. After the thread is executed, the next thread is executed.

Source: Internet
Author: User

[Csharp]
Thread tr = null;
Delegate void Methinvoker ();
Private void btSeInfo_Click (object sender, EventArgs e)
{
 
Tr = new Thread (new ThreadStart (SeleInfo ));
Tr. IsBackground = true;
// Tr. SetApartmentState (ApartmentState. STA );
Tr. Start ();
 
 
Thread tr1 = new Thread (new ThreadStart (StartThreadCaiji ));
Tr1.Start ();
}
Private void StartThreadCaiji ()
{
Tr. Join ();
Methinvoker meth = new Methinvoker (MessSeInfo );
This. BeginInvoke (meth );
}
Private void MessSeInfo ()
{
 
// Monitor. Enter (obj );
// Monitor. Wait (obj );
MessageBox. show ("Total number of records successfully collected after data collection is completed: [" + caiji. toString () + "] \ n, where red signals indicate communication errors, and Green indicates extraction successful! "," Prompt ", MessageBoxButtons. OK, MessageBoxIcon. Information );
PbLoad. Value = 0;
Tbpg. Text = "";
Caiji = 0;
BtStopSelect. Enabled = false;
// Monitor. Exit (obj );
}

Thread tr = null;
Delegate void Methinvoker ();
Private void btSeInfo_Click (object sender, EventArgs e)
{

Tr = new Thread (new ThreadStart (SeleInfo ));
Tr. IsBackground = true;
// Tr. SetApartmentState (ApartmentState. STA );
Tr. Start ();


Thread tr1 = new Thread (new ThreadStart (StartThreadCaiji ));
Tr1.Start ();
}
Private void StartThreadCaiji ()
{
Tr. Join ();
Methinvoker meth = new Methinvoker (MessSeInfo );
This. BeginInvoke (meth );
}
Private void MessSeInfo ()
{

// Monitor. Enter (obj );
// Monitor. Wait (obj );
MessageBox. show ("Total number of records successfully collected after data collection is completed: [" + caiji. toString () + "] \ n, where red signals indicate communication errors, and Green indicates extraction successful! "," Prompt ", MessageBoxButtons. OK, MessageBoxIcon. Information );
PbLoad. Value = 0;
Tbpg. Text = "";
Caiji = 0;
BtStopSelect. Enabled = false;
// Monitor. Exit (obj );
}

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.