多線程這裡,我主要是使用全域變數來控制當前線程數量,在每個線程內部,已啟動就進行原子操作增加當前活動線程數量,線程結束時再進行原子操作,減少當前活動線程數量。當隊列為空白並且活動線成為0時,認為任務完成,退出迴圈。如果隊列為空白但是有活動線程則主線程休眠,然後再次判斷條件。隊列線程均不為空白,或隊列不空線程為空白,判斷線程數量並決定是否開啟新線程抓取。 /* * XssScan.cs,雲舒,070704下午 */ using System; using System.Threading;
用C++寫程式,肯定要用先行編譯標頭檔,就是那個stdafx.h.不過我一直以為只要在.cpp檔案中包含stdafx.h 就使用了先行編譯標頭檔,其實不對。在VC++中,先行編譯標頭檔是指放到stdafx.h中的標頭檔才會有效果。如下: file: stdafx.h// stdafx.h : include file for standard system include files,// or project specific include files that are used
CodeCode highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--> 1 using System; 2 using System.Collections.Generic; 3 using System.Text; 4 using System.IO; 5 6 namespace createfile1 7 { 8 class Program 9
從本節開始,本文正式更名為C#3.0入門系列。先發布一則訊息,VS2007 Beta版本已經發布咯,:http://www.microsoft.com/downloads/details.aspx?FamilyID=1FF0B35D-0C4A-40B4-915A-5331E11C39E6&displaylang=en大家快去下載呀,我也好和大家一起體驗該版本最新功能呀。dlinq也更名為linq to sql.本文也跟著做相應變化,稍候,我會去更新前面的文章。我們先接著講linq的文法。
using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication8 { //定義委託 public delegate bool CompareDelegate(int a, int b); public class MyCompare { /// <summary>