mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-30 07:40:27 +02:00
+ Implemented sleep() on Unix.
This commit is contained in:
parent
7fe8425a8a
commit
67d7dcdc91
@ -16,11 +16,17 @@
|
||||
{ OS handling utilities }
|
||||
|
||||
Function GetEnvironmentVariable(Const EnvVar : String) : String;
|
||||
{$IFDEF HAS_SLEEP}
|
||||
procedure Sleep(milliseconds: Cardinal);
|
||||
{$ENDIF}
|
||||
function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString):integer;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.3 2004-01-05 22:37:24 florian
|
||||
Revision 1.4 2004-01-10 17:34:36 michael
|
||||
+ Implemented sleep() on Unix.
|
||||
|
||||
Revision 1.3 2004/01/05 22:37:24 florian
|
||||
* changed sysutils.exec to ExecuteProcess
|
||||
|
||||
Revision 1.2 2004/01/03 08:55:58 marco
|
||||
|
@ -21,7 +21,7 @@ interface
|
||||
{ force ansistrings }
|
||||
{$H+}
|
||||
|
||||
{$DEFINE HAS_EXEC_ANSI}
|
||||
{$DEFINE HAS_SLEEP}
|
||||
|
||||
uses
|
||||
Unix,errors,sysconst;
|
||||
@ -517,7 +517,25 @@ Begin
|
||||
end;
|
||||
End;
|
||||
|
||||
procedure Sleep(milliseconds: Cardinal);
|
||||
|
||||
Var
|
||||
fd : Integer;
|
||||
fds : TfdSet;
|
||||
timeout : TimeVal;
|
||||
|
||||
begin
|
||||
fd:=FileOpen('/dev/null',fmOpenRead);
|
||||
If Not(Fd<0) then
|
||||
begin
|
||||
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);
|
||||
end;
|
||||
end;
|
||||
|
||||
{****************************************************************************
|
||||
Initialization code
|
||||
****************************************************************************}
|
||||
@ -531,7 +549,10 @@ end.
|
||||
{
|
||||
|
||||
$Log$
|
||||
Revision 1.29 2004-01-05 22:42:35 florian
|
||||
Revision 1.30 2004-01-10 17:34:36 michael
|
||||
+ Implemented sleep() on Unix.
|
||||
|
||||
Revision 1.29 2004/01/05 22:42:35 florian
|
||||
* compilation error fixed
|
||||
|
||||
Revision 1.28 2004/01/05 22:37:15 florian
|
||||
|
Loading…
Reference in New Issue
Block a user