Page 1 of 1

[Question] [Lua] Examples of Select or Poll.

Posted: 13 Jul 2013, 18:41
by psigelo
First: Sorry for my English.

Hello everyone,

I have an problem with socket communication in vrep side, the problem is when i want receive information but the information is not available yet, then vrep consumes more than 100% of my CPU i think because the receive function is equal to "read" in cpp.

I need examples of "select" or "poll" function in lua because when I search in google I don't understand the solutions because there are no good examples.

thanks for your help.

Re: [Question] [Lua] Examples of Select or Poll.

Posted: 14 Jul 2013, 16:09
by coppelia
Hello,

Have you tried using settimeout(0)?

If runing your code in a threaded child script, make sure to call simSwitchThread() on a regular basis (e.g. when you couldn't read data).
Cheers

Re: [Question] [Lua] Examples of Select or Poll.

Posted: 14 Jul 2013, 19:03
by psigelo
Thanks, is exactly what I needed