Roku Developer Program

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

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

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 Smiley Happy

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
Level 7

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

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