mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-01 11:49:37 +01:00
* nanosleep for sleep(), since it is now in the POSIX group.
git-svn-id: trunk@1341 -
This commit is contained in:
parent
8f50bb556e
commit
f054a6df16
@ -259,7 +259,7 @@ begin
|
||||
fpclose(Handle);
|
||||
end;
|
||||
|
||||
Function FileTruncate (Handle,Size: Longint) : boolean;
|
||||
Function FileTruncate (Handle,Size: TFileOffset) : boolean;
|
||||
|
||||
begin
|
||||
FileTruncate:=fpftruncate(Handle,Size)>=0;
|
||||
@ -1057,22 +1057,12 @@ End;
|
||||
procedure Sleep(milliseconds: Cardinal);
|
||||
|
||||
Var
|
||||
fd : Integer;
|
||||
fds : TfdSet;
|
||||
timeout : TimeVal;
|
||||
timeout,timeoutresult : TTimespec;
|
||||
|
||||
begin
|
||||
fd:=FileOpen('/dev/null',fmOpenRead);
|
||||
If Not(Fd<0) then
|
||||
try
|
||||
fpfd_zero(fds);
|
||||
fpfd_set(0,fds);
|
||||
timeout.tv_sec:=Milliseconds div 1000;
|
||||
timeout.tv_usec:=(Milliseconds mod 1000) * 1000;
|
||||
fpSelect(1,Nil,Nil,@fds,@timeout);
|
||||
finally
|
||||
FileClose(fd);
|
||||
end;
|
||||
timeout.tv_sec:=milliseconds div 1000;
|
||||
timeout.tv_nsec:=1000*1000*(milliseconds mod 1000);
|
||||
fpnanosleep(@timeout,@timeoutresult);
|
||||
end;
|
||||
|
||||
Function GetLastOSError : Integer;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user