Jump to content

[Q] OmniThreadLibry AV at Task.Invoke

Recommended Posts

I'm getting multiple reports of AccessViolations inside Task.Invoke function call, it seems that Task.Invoke can/will be called after thread termination unlike TThread.Queue that will not.


is that correct behavior, how to wait for the end of Task.Invoke execution?


@Primož Gabrijelčič

Edited by DPStano

Share this post

Link to post

same AV i see in logs from OnTerminated


  FTask := CreateTask(
    procedure(const Task: IOmniTask)



procedure TFoo.OnThreadTermination(const Task: IOmniTaskControl);
  FTaskGroup.Remove(FTask); //AV Here



but TFoo holding FTask And FTaskGroup reference is waiting for WaitForAll in its destructor

destructor TFoo.Destroy;
  // stop all threads



it looks like OnTerminated will be somehow called after WaitForAll


Edited by DPStano

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