AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de servicios
  • Tips
  • Use mode
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Pauses the current service during the specified duration.
Note This function is ignored if it is not called in a Service application.
Ejemplo
// -- Running the service (called in loop) --

// Main loop of the service
// Check the presence of files in the directory
sFileList is string
sFileList = fListFile("c:\temp\entry\*.*", frNotRecursive)

// If files have been included in the directory, they are processed by the service
IF sFileList <> "" THEN
ProcessFileList(sFileList)
END

// Wait during 10 seconds between two loops
ServiceWait(10*100)
Sintaxis
ServiceWait(<Wait>)
<Wait>: Integer or Duration
Timeout defined for the current thread of service (in hundredths of a second). This parameter can correspond to:
  • an integer corresponding to the number of hundredths of a second,
  • a Duration variable,
  • the duration in a readable format (e.g., 1 s or 10 ms).
Observaciones

Tips

  • A Service application runs the "Service execution" event in a loop. To avoid consuming the computer's processor resources, ServiceWait must be used at the end of this event.
  • Multitask, Wait or ThreadPause must not be used in a Service application.

Use mode

ServiceWait is required if the service code does not perform the timeout by itself.
The execution of ServiceWait 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 ServiceWait.
  • Category 1
    When the ServiceWait is useless: when the service is waiting for an external request. For example:
    • a server for communicating by sockets that waits for a connection request (SocketWaitForConnection)
    • a service that waits for an external signal (EventWait)
    • a service waiting for an internal synchronization of threads.
    In these cases, ServiceWait has no effect. However, a specific stop code must be used to interrupt the wait.
    Note A classic service, as its name suggests, offers services to other processes: it is therefore waiting for external "commands" and is in category 1, for which the function ServiceWait function.
  • Category 2
    When the ServiceWait is of little use: checks in fast loops (of the order of a second). For example, checking the status of a database file one a regular basis.
    The service stays for less than one second in the timeout and ThreadPause 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 ServiceWait is very useful: checks spaced out over time. For example, processing a spool of files in a directory with directory checks every 5 minutes.
    Remark: In this case, a scheduled task is often more appropriate.
Componente: wd300vm.dll
Versión mínima requerida
  • Versión 15
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/03/2025

Señalar un error o enviar una sugerencia | Ayuda local