Closed cblesing closed 3 months ago
Thanks for your feedback. I am not sure that the use of fork creates completely independent processes. The man page on https://www.man7.org/linux/man-pages/man2/fork.2.html says: "The entire virtual address space of the parent is replicated in the child, including the states of mutexes, condition variables, and other pthreads objects." I would not rule out the possibility that replicated mutexes are blocking execution. But this is just a guess.
If you are using MQTT, which I think is a good choice, you might implement a MQTT client for each lidar and run them in 2 separate processes.
Hey everyone,
I recently asked in #269 about the best way to control two scanners without ROS. Me and my colleagues decided to use the old c-function
fork()
to generate two processes. The plan was that each of that processes then runs one scanner. But we encountered a strange behaviour when we use fork. If I link the sick scan xd library in the CMakeList into our program, the fork-function did not work properly. To make it easier to see here is the code, it is very simple :)And here is the CMakeList part:
Nothing special here. If we dont use the sick scan xd lib, the output of of the 3 lines of code is of course:
But if we link your library in we get only:
What is going on there? It seams that the main/parent process is no longer there. Do you have any idea why or how this happend? I had a look at your top level
CMakeList.txt
but did not found a hint or so. Thanks in advance.Best regards, Christian