+ Added NanoSleep example

This commit is contained in:
michael 2002-08-30 06:32:14 +00:00
parent 12c3e9a760
commit abe97bf0da
3 changed files with 30 additions and 2 deletions

View File

@ -37,8 +37,8 @@ OBJECTS=ex1 ex2 ex3 ex4 ex5 ex6 ex7 ex8 ex9 ex10 ex11 ex12 ex13 ex14 \
ex28 ex29 ex30 ex31 ex32 ex33 ex34 ex35 ex36 ex37 ex38 ex39 ex40 \
ex41 ex42 ex43 ex44 ex45 ex46 ex47 ex48 ex49 ex51 ex52 ex53 ex54 ex55 \
ex56 ex57 ex58 ex59 ex60 ex61 ex62 ex63 ex64 ex65 ex66 \
ex67 ex68 ex69 ex70 ex71
# ex72 ex73 ex74 ex75 ex76 ex77
ex67 ex68 ex69 ex70 ex71 ex72
# ex73 ex74 ex75 ex76 ex77
TEXOBJECTS=$(addsuffix .tex, $(OBJECTS))

View File

@ -72,4 +72,5 @@ ex68.pp contains an example of the Octal function.
ex69.pp contains an example of the FNMatch function.
ex70.pp contains an example of the StringToPPchar function.
ex71.pp contains an example of the clone function.
ex72.pp contains an example of the NanoSleep function.
serial.pp contains an example of serial port programming in FPC.

27
docs/linuxex/ex72.pp Normal file
View File

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