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: 
ratish
Visitor

calling roDateTime in Main Thread throws Execution timeout

Hi

I am creating roDateTime in Main Thread and calling its function a a loop of 700 iterations. App is throwing Execution Timeout. Nowhere its documented that calling roDateTime function is expensive. Is calling this function 700 times in Main Thread( UX Thread) unsafe?   
0 Kudos
3 REPLIES 3
NB_
Roku Guru

Re: calling roDateTime in Main Thread throws Execution timeout

Don't call the render thread a "main thread" - that causes confusion, since there is also the app thread - the one that creates roSgScreen and it's render thread - that one is even main-er 🙂

You shall NOT block the render thread for a long periods of time, ever. Every call on it is supposed to finish well under 17ms, so that it can redraw the screen 60 times per second. If you "hog" it, you are hurting the UI - and if you do that for long (>3sec), the OS will kill the app. The long-running jobs should be done in a task thread or in the app thread.
0 Kudos
ratish
Visitor

Re: calling roDateTime in Main Thread throws Execution timeout

Thanks. Will take care of it. Wondering how it worked before 7.6 firmware update. It all started throwing this timeout after 7.6 firmware update.
0 Kudos
NB_
Roku Guru

Re: calling roDateTime in Main Thread throws Execution timeout

Enforcing render thread timeout may have started in 7.6, i don't know the detail on that. But app code (ab)using the render thread for a long, uninterrupted time has always been a bad idea, regardless if we were policing it 8-) - it leads to irresponsive UI, simple as that - player seems "hanging"
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.