You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I discovered this using the Python API, but it's most likely present everywhere. See below the desription and a MWE in Python:
In the Python API, StreamInlet.open_stream(timeout) is not completely blocking. If you create an outlet, create an inlet, open the stream on the inlet and then immediately push. a sample and pull a sample (with a positive timeout to wait until a sample appears in the inlet), it will hang out for the duration of the timeout specified in pull_sample because the sample was pushed before the stream was completely open. At least that's my interpretation. Here is a MWE:
import time
from pylsl import StreamInfo, StreamInlet, StreamOutlet, resolve_streams
sinfo = StreamInfo("test", "", 1, 0.0, "string", "test-stream")
outlet = StreamOutlet(sinfo)
stream = resolve_streams(wait_time=2)[0]
inlet = StreamInlet(stream)
inlet.open_stream(timeout=1000)
time.sleep(0.1) # comment to show the issue
outlet.push_sample("1")
data, ts = inlet.pull_sample(timeout=2)
assert len(data) == 1
With the sleep, data is received; without the sleep, inlet.pull_sample exit after 2 seconds and data is None .
The text was updated successfully, but these errors were encountered:
I discovered this using the Python API, but it's most likely present everywhere. See below the desription and a MWE in Python:
In the Python API,
StreamInlet.open_stream(timeout)
is not completely blocking. If you create an outlet, create an inlet, open the stream on the inlet and then immediately push. a sample and pull a sample (with a positive timeout to wait until a sample appears in the inlet), it will hang out for the duration of the timeout specified inpull_sample
because the sample was pushed before the stream was completely open. At least that's my interpretation. Here is a MWE:With the sleep,
data
is received; without the sleep,inlet.pull_sample
exit after 2 seconds anddata
isNone
.The text was updated successfully, but these errors were encountered: