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

Is ping_gstd thread safe ? #318

Open
MaxandreOgeret opened this issue Jan 24, 2023 · 1 comment
Open

Is ping_gstd thread safe ? #318

MaxandreOgeret opened this issue Jan 24, 2023 · 1 comment

Comments

@MaxandreOgeret
Copy link

MaxandreOgeret commented Jan 24, 2023

Hello,
I would like to know if the python libgstc function is thread safe.

def ping_gstd(self):

I want to continuously ping the gstd server in an other thread.
I had a look at the code and it seems that it is, as a new socket is created for each communication with gstd. But then can you guarantee that it will stay that way ?

Thanks.

@michaelgruner
Copy link
Contributor

Hey @MaxandreOgeret sorry for the slow response. There are two things two consider:

  1. By default, the TCP server in Gstd is allowed to spawn as many threads as it needs. This means that, effectively, two requests may be taking place simultaneously. You may limit the number of simultaneous threads with the --tcp-max-threads option to 1, for example, and make sure all requests are serialized.
  2. On the other hand, the ping command internally just tries to list the available pipelines, which is a thread safe operation. The pipeline list is locked every time it is read or modified.

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