91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 0.05M
    文件類型: .zip
    金幣: 1
    下載: 0 次
    發布日期: 2024-04-23
  • 語言: C#
  • 標簽: 多線程??線程??

資源簡介


資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Text;
using?System.Windows.Forms;
using?System.Threading;

namespace?MultiThreading
{
????///?
????///?此實例:為SDP軟件快速開發平臺中使用到的真實方法
????///?

????public?partial?class?Form1?:?Form
????{
????????///?
????????///?私有:線程同步信號
????????///?

????????private?ManualResetEvent?cmdWaiter;

????????///?
????????///?委托更新進度條
????????///?

????????private?delegate?void?updateBar();

????????///?
????????///?結束提示委托
????????///?

????????private?delegate?void?showEnd();

????????///?
????????///?任務隊列
????????///?注意:此任務隊列?需要用戶自動來定義?
????????///?實例中采用?string?來處理
????????///?

????????private?List?taskList?=?new?List();

????????///?
????????///?構造函數
????????///?

????????public?Form1()
????????{
????????????InitializeComponent();
????????}

????????///?
????????///?頁面初始化加載
????????///?

????????///?
????????///?
????????private?void?Form1_Load(object?sender?EventArgs?e)
????????{

????????????//?阻塞當前線程
????????????cmdWaiter?=?new?ManualResetEvent(false);

????????????//?啟動線程池
????????????ThreadPool.QueueUserWorkItem(new?WaitCallback(this.On_ThreadEvent));

????????}

????????///?
????????///?線程處理事務
????????///?

????????///?
????????private?void?On_ThreadEvent(object?obj)
????????{
????????????while?(true)
????????????{
????????????????try
????????????????{
????????????????????//?阻塞當前線程,等待解除指令
????????????????????this.cmdWaiter.WaitOne();

????????????????????//?執行我們需要處理的事務
????????????????????for?(int?k?=?0;?k?????????????????????{
????????????????????????Run_MyBusiness(taskList[k]);

????????????????????????//?休息指定的毫秒
????????????????????????Thread.Sleep(50);
????????????????????}


????????????????????//?清除隊列數據
????????????????????this.taskList.Clear();

????????????????????this.On_EndLog();
????????????????????this.cmdWaiter.Reset();
????????????????}
????????????????catch?(Exception?e)
????????????????{
????????????????????string?strError?=?e.Message.ToString();
????????????????????this.taskList.Clear();
????????????????????this.cmdWaiter.Reset();
????????????????}
????????????}
????????}

????????///?
????????///?執行我們自己的業務
????????///?

????????///?
????????private?void?Run_MyBusiness(string?str)
????????{
????????????//?委托更新
????????????updateBar?updateDelegate?=?new?updateBar(On_Update);
????????????this.Invoke(updateDelegate);
????????}

????????///?
????????///?開始按鈕
????????///?

????????///?
????????///?
????????private?void?btn_Start_Click(obj

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????2909??2019-07-16?10:41??51Aspx源碼必讀.txt
?????文件????????4659??2019-07-11?11:59??Form1.Designer.cs
?????文件????????4387??2019-07-11?12:20??Form1.cs
?????文件????????5817??2019-07-11?11:59??Form1.resx
?????文件????????3435??2019-07-11?09:46??MultiThreading.csproj
?????文件?????????869??2019-07-16?10:38??MultiThreading.sln
?????文件?????????475??2019-07-11?09:45??Program.cs
?????目錄???????????0??2019-07-11?09:45??Properties\
?????文件????????1378??2019-07-11?09:45??Properties\AssemblyInfo.cs
?????文件????????2879??2019-07-11?09:45??Properties\Resources.Designer.cs
?????文件????????5612??2019-07-11?09:45??Properties\Resources.resx
?????文件????????1100??2019-07-11?09:45??Properties\Settings.Designer.cs
?????文件?????????249??2019-07-11?09:45??Properties\Settings.settings
?????目錄???????????0??2019-07-11?09:45??bin\
?????目錄???????????0??2019-07-16?10:37??bin\Debug\
?????文件???????10752??2019-07-16?10:37??bin\Debug\MultiThreading.exe
?????文件???????24064??2019-07-16?10:37??bin\Debug\MultiThreading.pdb
?????文件???????11608??2019-07-16?10:40??bin\Debug\MultiThreading.vshost.exe
?????文件?????????490??2018-04-12?07:35??bin\Debug\MultiThreading.vshost.exe.manifest
?????文件????????4945??2019-04-16?10:31??from?-?.gif
?????目錄???????????0??2019-07-11?09:45??obj\
?????目錄???????????0??2019-07-11?09:45??obj\x86\
?????目錄???????????0??2019-07-16?10:37??obj\x86\Debug\
?????文件????????5458??2019-07-16?10:37??obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件?????????180??2019-07-11?12:21??obj\x86\Debug\MultiThreading.Form1.resources
?????文件?????????180??2019-07-11?12:21??obj\x86\Debug\MultiThreading.Properties.Resources.resources
?????文件????????1796??2019-07-16?10:40??obj\x86\Debug\MultiThreading.csproj.FileListAbsolute.txt
?????文件?????????975??2019-07-16?10:37??obj\x86\Debug\MultiThreading.csproj.GenerateResource.Cache
?????文件???????10752??2019-07-16?10:37??obj\x86\Debug\MultiThreading.exe
?????文件???????24064??2019-07-16?10:37??obj\x86\Debug\MultiThreading.pdb
?????文件?????????704??2019-07-11?12:21??obj\x86\Debug\ResGen.read.1.tlog
............此處省略3個文件信息

評論

共有 條評論