version 2003
PA_PutProcessToSleep (pNum; time)
Parameter | Type | Description | |
pNum | long | Process number | |
time | long | Delay expressed in ticks |
Description
The routine PA_PutProcessToSleep delays the execution of the process whose number is passed in pNum for a number of ticks passed in time.
A delayed process can be awaken by PA_UnfreezeProcess.
NOTE
If the process was already delayed when the call is made, the new delay replaces the remaining time rather than adding to it.
This entry point does the same thing than the 4D Command DELAY PROCESS. For more information, refer to the 4th Dimension Language Reference manual.
Example
Generic routine to delay any process. As the User/Custom menus process cannot be delayed using PA_PutProcessToSleep, we must include a waiting loop in this case.
long MyDelayCurrentProcess(long delayInTicks) { long currentProcess = PA_GetCurrentProcessNumber(); if(currentProcess != 1) PA_PutProcessToSleep(currentProcess, delayInTicks); else { long start; // GetTheTicks is a routine that returns the ticks count // under both Windows and MacOS start = GetTheTicks(); while( (GetTheTicks() - start) < delayInTicks ) PA_Yield(); } }
See Also
DELAY PROCESS, PA_FreezeProcess, PA_UnfreezeProcess.
Error Handling
Use PA_GetLastError to see if an error occurred