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

Typically: "How do I... ", "How can I... " questions
Post Reply
psigelo
Posts: 2
Joined: 13 Jul 2013, 02:03

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

Post by psigelo » 13 Jul 2013, 18:41

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.

coppelia
Site Admin
Posts: 7199
Joined: 14 Dec 2012, 00:25

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

Post by coppelia » 14 Jul 2013, 16:09

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

psigelo
Posts: 2
Joined: 13 Jul 2013, 02:03

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

Post by psigelo » 14 Jul 2013, 19:03

Thanks, is exactly what I needed

Post Reply