Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gutembergrcc
Level 7

Task control to stop at the right time

hello guys,

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.

0 Kudos
2 REPLIES 2
sanity-check
Level 9

Re: Task control to stop at the right time

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.

 

0 Kudos
gutembergrcc
Level 7

Re: Task control to stop at the right time

Hi @sanity-check ,

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. 

0 Kudos