Jump to content
Shrinavat

High-level abstractions - Difficulties in choosing and using appropriate strategies for solving my task.

Recommended Posts

You have:

  Renderer := Parallel.ParallelTask.NumTasks(numTasks).NoWait
    .Execute(
      procedure
      begin
        workItem := RenderQueue.Next;
        ...
      end);

and then:

  for iTask := 0 to numTasks-1 do begin
    TileSource := workItem.Data['TileSource' + iTask.ToString];
    RenderQueue.Add(TOmniValue.Create([iTask, TileSource]));
  end;

If you change only the parameter to `ParallelTask.NumTasks`, some tasks won't ever get data because you'll schedule only `numTasks` items to `RenderQueue`.

  • Thanks 1

Share this post


Link to post
On 1/31/2019 at 1:58 PM, Primož Gabrijelčič said:

`workItem.Result` is a record property. Because of that, this code:


 workItem.Result.AsOwnedObject := TBitmap32.Create(256,256);

is equivalent to running:


var tmp: TOmniValue;

tmp := workItem.Result;
tmp.AsOwnedObject := TBitmap32.Create(256,256);

And that fails. You should change the code to:


var tmp: TOmniValue;

tmp.AsOwnedObject := TBitmap32.Create(256,256);
workItem.Result := tmp;

I'll see if I can change the implementation of `IOmniWorkitem` to prevent such problems. 

@Primož Gabrijelčič Do you have any progress for this issue fix? There are no new commits on github. Current workaround with using extra variable is not very elegant, although it works. 

Share this post


Link to post
On 2/8/2019 at 7:46 AM, Shrinavat said:

@Primož Gabrijelčič Do you have any progress for this issue fix? There are no new commits on github. Current workaround with using extra variable is not very elegant, although it works. 

No, and don't expect one soon. There are more urgent issues to be fixed before.

  • Sad 1

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
×