I have a problem about Task that are getting allocated and not being released. With that, in the customization of the native player, each video that is played is accumulating tasks, and there comes a time that exceeds 100 tasks and the device crashes.
I found the solution to stop the Task manually by changing the Control to STOP when exiting the video. This solution worked and the Tasks were eliminated correctly.
The current problem is that the Tasks are asynchronous, with that in a situation I can give a STOP and the Task is still finishing the processing of some event. Is there any property that can know that the Task is WAIT or not doing anything and can close it? or BRS does not support this.
If I haven't misunderstood, you want a way to tell your task to stop nicely when it's ready.
You could try adding a boolean field to the task ("abort", "finish", something like that) then checking it in the main loop of your task. If true, do whatever cleanup you need and exit. I've done this before for video analytics and concurrency management stuff, seemed to work OK.
When you finish your Task loop, do you change the Task's control? Or just clear variables? In my task in the loop, I interrupt the while true, but even so, the Task remains in memory, it only exits when I change the control to Stop or Done.