Menu

#3 timeout for yarp::os::Port::read

eurobot
closed
nobody
None
5
2017-11-02
2010-01-13
jcgvicto
No

If I understood correctly, yarp::os::Port::read is a blocking function. Would the 'correct' way to create a timeout be using it in a yarp::os::Thread, then kill the thread after a certain yarp::os::Time::delay?

Discussion

  • Paul Fitzpatrick

    Yes, yarp::os::Port::read is blocking. You can alternatively set up a callback using yarp::os::Port::setReader, or (perhaps easier) use yarp::os::BufferedPort::read which takes a blocking/non-blocking flag. BufferedPort::getPendingReads will tell you how many messages are waiting to be read. BufferedPort can also be set up to use a callback.

    Is that sufficient, or do you really need a blocking read with timeout?

     
  • jcgvicto

    jcgvicto - 2010-03-15

    Okay, that is a good set of options. Thank you.

     
  • Daniele E. Domenichelli

    • status: open --> closed
    • Group: --> eurobot