Jump to content
A.M. Hoornweg

tParallelArray and interfaces

Recommended Posts

Hello all,

 

just a short question: is System.Threading.tParallelarray not usable with interfaces?  The following won't compile:

 

 

Type iDownloadJob=Interface
  [{3d24b7a2-6111-46e7-a281-7fdc318be5c4}]
  procedure Download;
end;


procedure test;
var x: array of iDownloadJob; 
    temp:Integer;
begin
  // ..... fill the array here ....

 temp:=tParallelArray.ForThreshold;
 tParallelArray.ForThreshold:=1;
 try
    tParallelArray.&For<iDownloadJob>(x,
    procedure (const AValues: array of iDownloadJob; AFrom, ATo: NativeInt)
    var i:NativeInt;
    begin  
        for i:=AFrom to ATo do
            aValues[i].Download;       
    end);
 finally 
    tParallelArray.ForThreshold:=temp;
 end;      
end;

 

It would be just my luck if such a nice new feature doesn't work for me 😞

 

 

 

Share this post


Link to post

It compiles for me... but after adding missing quotes in interface GUID declaration. TParallelArray is not the problem here.

Share this post


Link to post
On 10/29/2024 at 11:04 AM, Dalija Prasnikar said:

It compiles for me... but after adding missing quotes in interface GUID declaration. TParallelArray is not the problem here.

 

This is a totally weird experience.  Tuesday my compiler kept saying "There is no overloaded version of tParallelArray.For ... that can be called with these arguments" and I searched in vain for the cause.

 

Then something came up and I had to abandon the project for a few days.  Today I resumed working on it and it compiled just fine - I had changed nothing! 
I think that something got corrupted in the memory of the IDE process on Tuesday and the reboot just made it go away...  I do have regular exceptions in the IDE since installing the inline update for 12.2 (build nr 29.0.53982.0329).

 

Anyway, I'm thrilled that I can continue now.

 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×