¹ØÓÚ delphi д·þÎñÆ÷³ÌÐòµÄÒÉÎÊ
delphi °ïÖúÎĵµ ¹ØÓÚ Service threads(·þÎñÏß³Ì) ÏÂÃæÁ½¶ÎÄÚÈÝ
Each service has its own thread (TServiceThread), so if your service application implements more than one service you must ensure that the implementation of your services is thread-safe. TServiceThread is designed so that you can implement the service in the TService OnExecute event handler. The service thread has its own Execute method which contains a loop that calls the service's OnStart and OnExecute handlers before processing new requests.
Because service requests can take a long time to process and the service application can receive simultaneous requests from more than one client, it is more efficient to spawn a new thread (derived from TThread, not TServiceThread) for each request and move the implementation of that service to the new thread's Execute method. This allows the service thread's Execute loop to process new requests continually without having to wait for the service's OnExecute handler to finish. The following example demonstrates.
Õâ¶Î»°µÄ´ó¸ÅÒâ˼ÊÇ˵:
ÿ¸ö·þÎñ¶¼ÓÐËü×Ô¼ºµÄÏß³Ì(TServiceThread),ËùÒÔÈç¹ûÒ»¸ö·þÎñÆ÷³ÌÐòʵÏÖÁ˶àÓÚÁ½¸ö·þÎñµÄ»°,¾ÍÒª¿¼ÂÇḬ̈߳²È«ÁË.service thread ÓÐ×Ô¼ºµÄExecute·½·¨,Ôڸ÷½·¨ÖÐÓÐÒ»¸öÑ»·,ÒÔÖØ¸´µ÷Ó÷þÎñµÄOnStartºÍOnExecuteÁ½Ê¼þµÄ´¦Àí³ÌÐò,ÕâÑù,ͨ¹ýÔÚOnStartºÍOnExecuteÁ½Ê¼þµÄ´¦Àí³ÌÐòÖÐд´úÂë¾Í¿ÉÒÔʵÏÖÕâ¸ö³ÌÐò.
ÒòΪ·þÎñÆ÷³ÌÐò¿ÉÄܽÓÊܵ½ºÜ¶à·þÎñÇëÇó,²¢ÇÒ´¦Àíÿ¸öÇëÇóµÄʱ¼ä¿ÉÄܺܳ¤,ËùÒÔ¶ÔÓ
Ïà¹ØÎÊ´ð£º
Çë½Ì¸÷·¸ßÊÖ¡£ÎäÁÖǰ±²¡£ÎÒ½«B.EXE×ö³É×ÊÔ´Îļþ£¬È»ºó¼Óµ½123.dllÖС£ÓÃA.EXEÀ´µ÷ÓÃ123.dllÖеÄB.EXE
Çë¸÷λǰ±²°ïæָ½ÌÏ¡£A.exeÈçºÎÀ´µ÷ÓÃdllÖеÄexe£¿´úÂëÓÖ¸ÃÈçºÎд£¿
ÎÞÈ˻شð£¿
×ö³É×ÊÔ´Î ......
VC ¿ØÖÆÌ¨³ÌÐò:
#include <iostream>
using namespace std;
int main()
{
const int def_buffer = 1024 * 4;
DWORD t;
BYTE b[def_buffer];
memset(b, 0, sizeof(b));
PBYTE p;
t = GetTickC ......
¸÷λ¸ßÊָϿì°ï°ïæ¡£
ÏÖÔÚÓÐÒ»¸ödelphiдµÄdll£¬º¯ÊýÖÐÓÐPIntegerµÄ·µ»Ø²ÎÊý£¬ÔÚdelphiÖпÉÒÔÕý³£µ÷Ó㬵«ÊÇÎÒÔÚvbÀïдµÄʱºò¾Í²»ÖªµÀ¸ÃÔõôÀ´µ÷ÓÃÁË¡£
Çë¿´´úÂë
ÒÔÏÂÊÇdelphiÖеĺ¯Êý¶¨ÒåºÍµ÷ÓôúÂ룬ÄÜÕý³£ÔËÐ ......
ÎÒ±¾À´ÔÚѧУÊÇŪµÄJ2EE
×òÌìÈ¥Á˳¤É³Ò»¼Ò¹«Ë¾Ó¦Æ¸ ˵ÊÇÓÐÒ»¸öÏîÄ¿ delphiµÄ
ʵϰÆÚÒ»¸öÔ ËÄÌì°ëµÄdelphiÅàѵ ºóÃæ25Ìì¸øÄãÒ»¸öÉè¼ÆÎĵµ×Ô¼º×öÒ»¸öÏîÄ¿
×ߺ󲻾ôòµç»°¹ýÀ´½ÐÎÒÐÇÆÚһȥ±¨µ½
¿´µ½delphiµ ......
¼±Óá£ÁªÏµQQ£º8775262£¬Ð»Ð»¡£
ÐèÒª½øÐÐDllImportµÄµØ·½Ö±½ÓдDLLImport.·½·¨Ãû¡£
È磺DLLImport.GlobalAddAtom(¡¡);
Îļþ£ºUShare.pas
Delphi(Pascal) code:
unit UShare;
interface
uses Windows, Me ......