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?
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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?
Okay, that is a good set of options. Thank you.