[Overview][Constants][Types][Procedures and functions][Index] Reference for unit 'BaseUnix' (#rtl)

FpNanoSleep

Suspend process for a short time

Declaration

Source position: bunxh.inc line 99

function FpNanoSleep(

req: ptimespec ;

rem: ptimespec

):cint ;

Description

FpNanoSleep suspends the process till a time period as specified in req has passed. Then the function returns. If the call was interrupted (e.g. by some signal) then the function may return earlier, and rem will contain the remaining time till the end of the intended period. In this case the return value will be -1, and ErrNo will be set to EINTR

If the function returns without error, the return value is zero.

Errors

If an error occurred or the call was interrupted, -1 is returned. Extended error information can be retrieved using fpGetErrno.

See also

FpPause

Wait for a signal to arrive

FpAlarm

Schedule an alarm signal to be delivered

Example

program example72;
{ Program to demonstrate the NanoSleep function. }
uses BaseUnix;
Var
 Req,Rem : TimeSpec;
 Res : Longint;
begin
 With Req do
 begin
 tv_sec:=10;
 tv_nsec:=100;
 end;
 Write('NanoSleep returned : ');
 Flush(Output);
 Res:=(fpNanoSleep(@Req,@rem));
 Writeln(res);
 If (res<>0) then
 With rem do
 begin
 Writeln('Remaining seconds : ',tv_sec);
 Writeln('Remaining nanoseconds : ',tv_nsec);
 end;
end.

Documentation generated on: May 14 2021

AltStyle によって変換されたページ (->オリジナル) /