Sleep API not working correctly in sub-procedures
Posted: Fri Oct 28, 2022 1:29 am
I searched the whole site and didn't find any posts on this. If I pass a constant value, the Sleep API works fine in sub-procedures(Sleep(4)). If I pass a variable name I get varying results (Sleep(SleepSeconds)). If the value comes from another variable that is packed the sleep command takes 15 seconds no matter what the value in the variable is. If it is assigned to a constant, the Sleep API does not stop. If the Sleep API is run in a different sub-procedure it doesn't stop running no matter how the variable was populated. If I place the Sleep prototype in the sub-procedure it does not make a difference. This is running on OS 7.2 currently and will be running on 7.4 soon. Thanks.
Global Declaraions:
Dcl-S SleepSeconds Uns(10); // Sleep time
Dcl-Pr Sleep ExtProc('sleep');
*n Uns(10) Const;
End-Pr;
Dcl-Proc $Init_Process;
GetConfig(ReturnCode:SyPcn);
If ReturnCode <> 'Fail';
SleepSeconds = Amt1cn; // Packed 7.0 from External DS
Else;
SleepSeconds = 2;
EndIf;
Sleep(SleepSeconds); // Test Sleep Function
Dcl-Proc $Proc_WebServ;
Dcl-Pi *N Ind;
End-Pi;
Sleep(SleepSeconds); // Test Sleep Function
Global Declaraions:
Dcl-S SleepSeconds Uns(10); // Sleep time
Dcl-Pr Sleep ExtProc('sleep');
*n Uns(10) Const;
End-Pr;
Dcl-Proc $Init_Process;
GetConfig(ReturnCode:SyPcn);
If ReturnCode <> 'Fail';
SleepSeconds = Amt1cn; // Packed 7.0 from External DS
Else;
SleepSeconds = 2;
EndIf;
Sleep(SleepSeconds); // Test Sleep Function
Dcl-Proc $Proc_WebServ;
Dcl-Pi *N Ind;
End-Pi;
Sleep(SleepSeconds); // Test Sleep Function