Forum Discussion
TheEndless
11 years agoRoku Guru
"Travonisoft" wrote:
If you don't use the wait function then you will never get the image.
And if the messagePort is a global port and it gets a message for the imageRequest completing then subsequent code will block even if user is pressing buttons because it is on the same msgPort
It sounds like you don't understand how message ports and event loops are meant to work. a) You're telling the texture request to block, because you've passed 0 into your wait(). If you set that to something higher than 0, then it will only block for the length of time (in milliseconds) you pass in. If you don't want to block at all, then you can pull a message directly by calling msgport.GetMessage() which will return immediately with "invalid" if there is no message ready. b) Why do you think your code will block after you get the roTextureRequestEvent?
You should look into how you're meant to implement event loops in the documentation: http://sdkdocs.roku.com/display/sdkdoc/Event+Loops