sccn / liblsl

C++ lsl library for multi-modal time-synched data transmission over the local network

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

inlet timestamp post processing could lead to timeout_error if using custom TimeUpdateInterval

cboulay opened this issue · comments

Prompted by a conversation with a user in Slack (whose issue turned out to be firewall blocking UDP), I discovered that clock offset post-processing uses a default timeout of 5.0 seconds. At least I think that's what's going on here:

postprocessor_([this]() { return time_receiver_.time_correction(5); },

If a user uses lsl_api.cfg and sets TimeUpdateInterval to >= 5.0 then there's a good chance that on the first pull the inlet will timeout while waiting for the clock offset.

if (!timeoffset_available()) {
// start thread if not yet running
if (!time_thread_.joinable()) time_thread_ = std::thread(&time_receiver::time_thread, this);
// wait until the timeoffset becomes available (or we time out)
if (timeout >= FOREVER)
timeoffset_upd_.wait(lock, timeoffset_available);
else if (!timeoffset_upd_.wait_for(
lock, std::chrono::duration<double>(timeout), timeoffset_available))
throw timeout_error("The time_correction() operation timed out.");
}