mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-10 10:49:22 +02:00
* TTimespan overload. Mostly fixes #37495
This commit is contained in:
parent
452ec93f06
commit
b77fec3433
@ -18,7 +18,7 @@ unit syncobjs;
|
||||
interface
|
||||
|
||||
uses
|
||||
sysutils;
|
||||
sysutils,system.timespan;
|
||||
|
||||
type
|
||||
PSecurityAttributes = Pointer;
|
||||
@ -53,6 +53,9 @@ type
|
||||
end;
|
||||
THandleObject= class;
|
||||
THandleObjectArray = array of THandleObject;
|
||||
|
||||
{ THandleObject }
|
||||
|
||||
THandleObject = class abstract (TSynchroObject)
|
||||
protected
|
||||
FHandle : TEventHandle;
|
||||
@ -64,7 +67,8 @@ type
|
||||
public
|
||||
constructor Create(UseComWait : Boolean=false);
|
||||
destructor Destroy; override;
|
||||
function WaitFor(Timeout : Cardinal=INFINITE) : TWaitResult;
|
||||
function WaitFor(Timeout : Cardinal=INFINITE) : TWaitResult;overload;
|
||||
function WaitFor(const Timeout : TTimespan) : TWaitResult;overload;
|
||||
{$IFDEF MSWINDOWS}
|
||||
class function WaitForMultiple(const HandleObjs: THandleObjectArray; Timeout: Cardinal; AAll: Boolean; out SignaledObj: THandleObject; UseCOMWait: Boolean = False; Len: Integer = 0): TWaitResult;
|
||||
{$ENDIF MSWINDOWS}
|
||||
@ -193,6 +197,11 @@ begin
|
||||
{$ENDIF OS2}
|
||||
end;
|
||||
|
||||
function THandleObject.WaitFor(const Timeout: TTimespan): TWaitResult;
|
||||
begin
|
||||
result:=waitfor(round(timeout.TotalMilliseconds));
|
||||
end;
|
||||
|
||||
{$IFDEF MSWINDOWS}
|
||||
class function THandleObject.WaitForMultiple(const HandleObjs: THandleObjectArray; Timeout: Cardinal; AAll: Boolean; out SignaledObj: THandleObject; UseCOMWait: Boolean = False; Len: Integer = 0): TWaitResult;
|
||||
var
|
||||
|
Loading…
Reference in New Issue
Block a user