Browse Source

* Improve Delphi compatibility of TEvent(object) constructors, while keeping also backwards compat by adding default parameters.

(cherry picked from commit 616538c2516640df33ac17702a0d5b957b69e445)
marcoonthegit 3 years ago
parent
commit
d85a33474e
1 changed files with 11 additions and 2 deletions
  1. 11 2
      packages/fcl-base/src/syncobjs.pp

+ 11 - 2
packages/fcl-base/src/syncobjs.pp

@@ -67,7 +67,9 @@ type
       FManualReset: Boolean;
       FManualReset: Boolean;
    public
    public
       constructor Create(EventAttributes : PSecurityAttributes;
       constructor Create(EventAttributes : PSecurityAttributes;
-        AManualReset,InitialState : Boolean;const Name : string);
+        AManualReset,InitialState : Boolean;const Name : string;
+        UseComWait:boolean=false);
+      constructor Create(UseComWait : Boolean=false);
       destructor destroy; override;
       destructor destroy; override;
       procedure ResetEvent;
       procedure ResetEvent;
       procedure SetEvent;
       procedure SetEvent;
@@ -153,7 +155,7 @@ begin
 end;
 end;
 
 
 constructor TEventObject.Create(EventAttributes : PSecurityAttributes;
 constructor TEventObject.Create(EventAttributes : PSecurityAttributes;
-  AManualReset,InitialState : Boolean;const Name : string);
+  AManualReset,InitialState : Boolean;const Name : string;UseComWait:boolean=false);
 
 
 begin
 begin
   FHandle := BasicEventCreate(EventAttributes, AManualReset, InitialState, Name);
   FHandle := BasicEventCreate(EventAttributes, AManualReset, InitialState, Name);
@@ -162,6 +164,13 @@ begin
   FManualReset:=AManualReset;
   FManualReset:=AManualReset;
 end;
 end;
 
 
+
+constructor TEventObject.Create(UseComWait : Boolean=false);
+// cmompatibility shortcut constructor, Com waiting not implemented yet
+begin
+ Create(nil,True,false,'',UseComWait);
+end;
+
 destructor TEventObject.destroy;
 destructor TEventObject.destroy;
 
 
 begin
 begin