delphiÏ̳߳ء¾×ª¡¿
[code=Delphi(Pascal)]
unit uThreadPool;
{ aPool.AddRequest(TMyRequest.Create(RequestParam1, RequestParam2, ...)); }
interface
uses
Windows,
Classes;
// ÊÇ·ñ¼Ç¼ÈÕÖ¾
// {$DEFINE NOLOGS}
type
TCriticalSection = class(TObject)
protected
FSection: TRTLCriticalSection;
public
constructor Create;
destructor Destroy; override;
// ½øÈëÁÙ½çÇø
procedure Enter;
// À뿪ÁÙ½çÇø
procedure Leave;
// ³¢ÊÔ½øÈë
function TryEnter: Boolean;
end;
type
// ´¢´æÇëÇóÊý¾ÝµÄ»ù±¾Àà
TWorkItem = class(TObject)
public
// ÊÇ·ñÓÐÖظ´ÈÎÎñ
function IsTheSame(DataObj: TWorkItem): Boolean; virtual;
// Èç¹û NOLOGS ±»¶¨Ò壬Ôò½ûÓá£
function TextForLog: string; virtual;
end;
type
TThreadsPool = class;
//Ïß³Ì״̬
TThreadState = (tcsInitializing, tcsWaiting, tcsGetting, tcsProcessing,
tcsProcessed, tcsTerminating, tcsCheckingDown);
// ¹¤×÷Ï߳̽öÓÃÓÚÏ̳߳ØÄÚ£¬ ²»ÒªÖ±½Ó´´½¨²¢µ÷ÓÃËü¡£
TProcessorThread = class(TThread)
*******
// ´´½¨Ïß³ÌʱÁÙʱµÄEvent¶ÔÏó, ×èÈûÏß³ÌÖ±µ½³õʼ»¯Íê³É
hInitFinished: THandle;
// ³õʼ»¯³ö´íÐÅÏ¢
sInitError: string;
// ¼Ç¼ÈÕÖ¾
procedure WriteLog(const Str: string; Level: Integer = 0);
protected
// Ïß³ÌÁÙ½çÇøͬ²½¶ÔÏñ
csProcessingDataObject: TCriticalSection;
// ƽ¾ù´¦Àíʱ¼ä
FAverageProcessing: Integer;
// µÈ´ýÇëÇóµÄƽ¾ùʱ¼ä
FAverageWaitingTime: Integer;
// ±¾Ïß³ÌʵÀýµÄÔËÐÐ״̬
FCurState: TThreadState;
// ±¾Ïß³ÌʵÀýËù¸½ÊôµÄÏ̳߳Ø
FPool: TThreadsPool;
// µ±Ç°´¦ÀíµÄÊý¾Ý¶ÔÏñ¡£
&
Ïà¹ØÎĵµ£º
delphi TWebBrowser×é¼þʹÓÃÏê½â
¸Ã×é¼þÊÇÒ»¸öä¯ÀÀÆ÷×é¼þ£¬¿ÉÒÔÏÔʾһ¸öÖ¸¶¨µØÖ·µÄÍøÒ³¡¢ÉèÖÃÍøÒ³´ò¿ªÊ±µÄÖ÷Ò³ÒÔ¼°¶ÔÍøÒ³½øÐÐÏà¹ØµÄ²Ù×÷£¬Í¬Ê±Ò²¿ÉÒÔ¶ÔHTMLÎļþ½øÐмôÇС¢¸´ÖÆ¡¢Õ³Ìù¡¢É¾³ýµÈ²Ù×÷¡£¸Ã
×é¼þÔÚInternet×é¼þÒ³ÖС£
  ......
Windows ÏÂÒ»¸öµäÐ͵ÄÌØÕ÷¾ÍÊǶàÈÎÎñ£¬ÎÒÃÇ¿ÉÒÔͬʱ´ò¿ª¶à¸ö´°¿Ú½øÐвÙ×÷£¬Ò²¿ÉÒÔͬʱÔËÐгÌÐòµÄ¶à¸öʵÀý£¬±ÈÈç¿ÉÒÔ´ò¿ªÐí¶à¸ö×ÊÔ´¹ÜÀíÆ÷½øÐÐÎļþµÄÒƶ¯¸´ÖƲÙ×÷¡£µ«ÓÐʱ³öÓÚijÖÖ¿¼ÂÇ£¨±ÈÈ簲ȫÐÔ£©£¬ÎÒÃÇÒª×ö³öһЩÏÞÖÆ£¬ÈóÌÐòÖ»Äܹ»ÔËÐÐÒ»¸öʵÀý¡£ÔÚDelphi±à³ÌÖУ¬±ÊÕß×ܽá³öÁËÒÔϼ¸ÖÖ·½·¨£º
¡¡¡¡Ò»¡¢ ²éÕÒ´°¿Ú·¨
¡¡¡ ......
תÔØ×Ô£ºhttp://www.cnblogs.com/jdmei520/archive/2009/06/17/1505053.html
Webservice¼¼ÊõµÄ³öÏÖ½«¸÷ÖÖ¿ª·¢¼¼ÊõºÍÓïÑÔÍêÈ«µÄÈÚºÏÁË£¬ÏÂÃæ¾ÍÕâÖÖÈÚºÏÔÚC#ºÍdelphiÖ®¼äµÄ½»»¥×öÒ»´ÎÈ«ÃæµÄÌåÏÖ
1.ʹÓÃC#´´½¨Ò»¸öWebservice·þÎñ¡£
ʹÓÃvs2005µÄÄ£°å´´½¨C#µÄwebservice·Ç³£ÈÝÒס£ÔÎļþÈçÏÂ:
[WebService(Namespace  ......
¹ý³ÌÎÞ·µ»ØÖµ£¬º¯ÊýÓзµ»ØÖµ¡£
procedure MyProc(m,n : Integer; o : String; p : Single = 2.5; q : String = 'Delphi');
ÈçÉÏÀýËùʾ£¬¹ý³ÌÉùÃ÷ºÍ¶¨ÒåÖУ¬¶à¸ö²ÎÊýÊÇÓ÷ֺŸô¿ªµÄ£¬µ«ÔÚµ÷ÓÃʱÊÇÓöººÅ¸ô¿ªµÄ ¡£eg£º
......