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

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

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. 
0 Kudos
gabek
Visitor

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

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.
0 Kudos