Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gutembergrcc
Reel Rookie

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
Roku Guru

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
Reel Rookie

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
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.