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

Timer within a Task returns on Render, not Task thread

Hello!

I have a timer I'd like as a part of a task.  However, the timer returns back on a render thread, not the Task thread, and therefore I can't do any of the stuff that's not available on a SceneGraph render thread.

Is there any way around this?  For reference, I'm doing a simple "Every 5 seconds make a network request" inside a standalone task.
0 Kudos
3 Replies
belltown
Level 7

Re: Timer within a Task returns on Render, not Task thread

If what you're timing is confined to the Task, then have the Task do its own timing using roTimespan and/or Wait(). The Timer Scene Graph component runs in the Render thread. 
https://github.com/belltown/
0 Kudos
gabek
Level 7

Re: Timer within a Task returns on Render, not Task thread

Thanks for the clarification!  I was hoping that wasn't the case, as the Timer component is an elegant component that would make sense being used in any kind of node.  But at least now I know.
0 Kudos
belltown
Level 7

Re: Timer within a Task returns on Render, not Task thread

If you really want to use a Timer component, you can. In the Timer event-handler, set a Task interface field value, which you can observe for changes in the Task run function. When the interface field changes, your Task can issue its next request.
https://github.com/belltown/
0 Kudos