View Issue Details

IDProjectCategoryView StatusLast Update
0037495FPCRTLpublic2020-08-06 17:24
ReporterBi0T1N Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Product Version3.3.1 
Summary0037495: [Patch] Add WaitFor function to TSynchroObject
DescriptionThis patch adds the method WaitFor to the TSynchroObject class as it is needed for Delphi compatibility.
http://docwiki.embarcadero.com/Libraries/Rio/en/System.SyncObjs.TSynchroObject.WaitFor
Additional InformationUnfortunately FPC does not support TTimeSpan yet (https://bugs.freepascal.org/view.php?id=35844) so the second WaitFor cannot be implemented.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

Bi0T1N

2020-08-05 23:38

reporter  

01-Add-WaitFor-function-to-TSynchoObject.patch (993 bytes)   
diff --git packages/fcl-base/src/syncobjs.pp packages/fcl-base/src/syncobjs.pp
index edd37784e2..26c34eef7c 100644
--- packages/fcl-base/src/syncobjs.pp
+++ packages/fcl-base/src/syncobjs.pp
@@ -37,6 +37,11 @@ type
    TSynchroObject = class(TObject)
       procedure Acquire;virtual;
       procedure Release;virtual;
+      function WaitFor(Timeout: Cardinal = INFINITE): TWaitResult; {overload;} virtual;
+      {
+      * Looks like #35844 needs to be applied first to have support for TTimeSpan
+      function WaitFor(const Timeout: TTimeSpan): TWaitResult; overload;
+      }
    end;
 
    TCriticalSection = class(TSynchroObject)
@@ -107,6 +112,18 @@ procedure TSynchroObject.Release;
 begin
 end;
 
+function TSynchroObject.WaitFor(Timeout: Cardinal = INFINITE): TWaitResult;
+begin
+  Result := wrError;
+end;
+
+{
+function TSynchroObject.WaitFor(const Timeout: TTimeSpan): TWaitResult;
+begin
+  Result := wrError;
+end;
+}
+
 procedure TCriticalSection.Enter;
 begin
   Acquire;

Marco van de Voort

2020-08-06 12:20

manager   ~0124611

Without overrides that actually do something, this seems pointless?

Bi0T1N

2020-08-06 17:24

reporter   ~0124621

The TSynchroObject is the base class for TCriticalSection, TConditionVariableCS, TCountdownEvent, ... but also for THandleObject which then is the base class for TEvent, TMutex, TSemaphore, ...
Most of them override the WaitFor methods but to implement them this patch is necessary.

Issue History

Date Modified Username Field Change
2020-08-05 23:38 Bi0T1N New Issue
2020-08-05 23:38 Bi0T1N File Added: 01-Add-WaitFor-function-to-TSynchoObject.patch
2020-08-06 12:20 Marco van de Voort Note Added: 0124611
2020-08-06 17:24 Bi0T1N Note Added: 0124621