gstd-1.x
gstd-1.x copied to clipboard
Is ping_gstd thread safe ?
Hello, I would like to know if the python libgstc function is thread safe.
https://github.com/RidgeRun/gstd-1.x/blob/a011affa67f240cbc7aaff5b00fdfd6124bdaece/libgstc/python/pygstc/gstc.py#L258
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.
Hey @MaxandreOgeret sorry for the slow response. There are two things two consider:
- 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-threadsoption to 1, for example, and make sure all requests are serialized. - On the other hand, the
pingcommand 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.