当前位置:网站首页>了解下C# 多线程
了解下C# 多线程
2022-08-02 08:17:00 【nginx】
using System;using System.Threading;namespace MultithreadingApplication{class ThreadCreationProgram{public static void CallToChildThread(){try{Console.WriteLine("Child thread starts");// 计数到 10for (int counter = 0; counter <= 10; counter++){Thread.Sleep(500);Console.WriteLine(counter);}Console.WriteLine("Child Thread Completed");}catch (ThreadAbortException e){Console.WriteLine("Thread Abort Exception");}finally{Console.WriteLine("Couldn't catch the Thread Exception");}}static void Main(string[] args){ThreadStart childref = new ThreadStart(CallToChildThread);Console.WriteLine("In Main: Creating the Child thread");Thread childThread = new Thread(childref);childThread.Start();// 停止主线程一段时间Thread.Sleep(2000);// 现在中止子线程Console.WriteLine("In Main: Aborting the Child thread");childThread.Abort();Console.ReadKey();}}}
边栏推荐
- R language plotly visualization: use the plotly visualization model to predict the true positive rate (True positive) TPR and false positive rate (False positive) FPR curve under different thresholds
- 轴流式水轮机隐私政策
- Flink 系统性学习笔记系列
- (Note) AXIS ACASIS DT-3608 Dual-bay Hard Disk Array Box RAID Setting
- Axial Turbine Privacy Policy
- CASA模型、CENTURY模型应用与案例分析
- The custom table form
- 自定义table表格
- OneNote 教程,如何在 OneNote 中创建更多空间?
- pnpm:简介
猜你喜欢

postman下载安装汉化及使用

USACO美国信息学奥赛竞赛12月份开赛,中国学生备赛指南

C Language Basics_Union

IO process thread -> process -> day4

pycharm的基本使用教程(1)
![[ansible] playbook explains the execution steps in combination with the project](/img/fe/82b8562075fef33490d5aae7e809f5.png)
[ansible] playbook explains the execution steps in combination with the project

Biotin-EDA|CAS:111790-37-5| 乙二胺生物素

Redis分布式锁入门

Biotin hydrazide HCl|CAS:66640-86-6|生物素-酰肼盐酸盐

etcd实现大规模服务治理应用实战
随机推荐
血气方刚的年轻小伙竟去做家政小哥,是怎样成功逆袭转行的
pnpm的安装与使用
Seleniu screenshots code and assign name to the picture
How to use postman
A young man with strong blood and energy actually became a housekeeper. How did he successfully turn around and change careers?
Biotin - LC - Hydrazide | CAS: 109276-34-8 | Biotin - LC - Hydrazide
二分类和多分类
【电子电路】长按键拉低电平,适用在有休眠机制的MCU但是没有看门狗,一个按键多个功能场景下使用
day_05模块
TiFlash 存储层概览
MySQL Workbench 安装及使用
JSP页面中page指令contentPage/pageEncoding具有什么功能呢?
Seleniu截图代码以及给图片赋值名字
day_05 time 模块
PyCharm usage tutorial (detailed version - graphic and text combination)
MFC最详细入门教程[转载]
下一个排列
Biotin-C6-amine|N-biotinyl-1,6-hexanediamine|CAS: 65953-56-2
离线部署通过tiup 配置好topology.yaml文件指定PD TV TIDBserver 是不是会自动在其他机器创建好对应得模块?
Spark 系统性学习笔记系列