【Visual Studio Visual Csharp】Threading

 using System;

using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Threading; namespace threadC { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Thread first_thread = new Thread(new ThreadStart(first_thread_procedure)); Thread second_thread = new Thread(new ThreadStart(second_thread_procedure)); first_thread.Start(); second_thread.Start(); first_thread.Join(); } public void first_thread_procedure() { Thread.Sleep(500); MessageBox.Show("Hello from first thread :) ... "); } public void second_thread_procedure() { Thread.Sleep(1000); MessageBox.Show("Hello from second thread :) ... "); } } }

No comments:

My New Favorite Music Genre Is Polish Noir

These 10 artists create music that is mystical, melancholy, magical, and more. ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏    ...

Contact Form

Name

Email *

Message *