Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: What issue occurs when PyLSL is not used from the main thread? #74

Open
Morgan243 opened this issue Jun 30, 2021 · 1 comment

Comments

@Morgan243
Copy link

Hello LSL Devs,

First, thanks for the hard work on a great library! You are simplifying a lot challenging aspects in this space.

I'm developing some code to help support development of models/analysis that run against LSL streams. However, I noted the following in your README - can someone please expand on this line:

On Linux one currently cannot call pylsl functions from a thread that is not the main thread.

I'm using threading.Timer() to push data at certain times and have not noticed any issues, though my validation has been limited.

I'm not exactly sure if Python is launching a thread behind the scenes, or if it's just not doing it in a way that breaks LSL, or perhaps it is breaking LSL and I have not noticed data quality issues yet.

So what issues am I expected to have? Does it cause undefined behavior somewhere?

Again, thanks for your time!

@cboulay
Copy link
Collaborator

cboulay commented Jun 30, 2021

If I recall correctly, you'd get a segfault when calling pylsl's liblsl functions.

That note has been there a long time, probably since Python 2.6, and probably Ubuntu 16 or older. Obviously you have newer Python, its packages, and system libraries, and liblsl has been updated as well. 1.15 is out, available on conda-forge or from the liblsl release page. We haven't cut a new pylsl release. We'll do that soon.

I can't remember the actual source of the segaults, and I can't remember if it was all functions or only some, so it's hard to know if the problem has fixed. I wouldn't bet on it being fixed, but if you can run all of the functions that you need in a thread then I wouldn't expect any undefined behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants