PC SOFT

WINDEV的在线文档

  • Tips
  • Use mode
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系:info@cn.windev.com
产品
WinDevWebDev-服务器代码WebDev-浏览器代码WinDev Mobile报表和查询
平台
WindowsLinuxWindows MobileWindows PhoneWindows Store appsAndroidAndroid Widget iPhone/iPad
语言
JavaPHPAjax用户代码(MCU)外部语言
数据库
HFSQLHFSQL Client/Server存储过程HF 5.5OLE DBODBC本地访问

Pauses the current service during the specified duration.

Note: This function is ignored if it is not called in a Service application.

例子
// -- Running the service (called in loop) --

// Main loop of the service
// Check the presence of files in the directory
sFileList字符串型
sFileList文件列表"c:\temp\entry\*.*"文件.不可递归

// If files have been included in the directory, they are processed by the service
如果sFileList不等于"",那么
ProcessFileListsFileList
结束

// Wait during 10 seconds between two loops
服务延时10*100

语法
服务延时(<Time-out>)
<Time-out>: Integer
Time-out for the current thread of the service (in hundredths of a second).

注意

Tips

  • A Service application runs the "Service execution" process in loop. To avoid consuming the processor resources of the computer, 服务延时 must be used at the end of this process.
  • 多任务, 延时 or 线程暂停 must not be used in a Service application.

Use mode

服务延时 is required if the code of the service does not perform a temporization or a wait by itself.
The execution of 服务延时 is automatically ended if a request for stopping the service occurs.

Let's see a classification of types of services and the use cases of 服务延时.

  • Category 1
    When 服务延时 is useless: when the service waits for an external request. For example:
    • a server for communicating by sockets that waits for a connection request (套接字等待连接)
    • a service that waits for an external signal (信号等待)
    • a service waiting for an internal synchronization of threads.
In these cases, 服务延时 is useless. However, a specific stop code must be used to interrupt the wait.
Note: A standard service proposes services to the other processes: therefore, it is waiting for external "commands" and it is found in category 1 for which 服务延时 is useless.
  • Category 2
    When 服务延时 is not very useful: checks in quick loops (one second). For example, checking the status of a database file one a regular basis.
    The service stays for less than one second in the time-out and 线程暂停 is sufficient. In a stop is requested, this stop will be performed at the end of the loop, therefore after a wait of a few seconds.
  • Category 3
    When 服务延时 is very useful: checks spaced out in time. For example, processing a spool of files in a directory with directory checks every 5 minutes.
    Note: In this case, a schedule task is recommended.

组件
WinDev wd200vm.dll
Linux wd200vm.so