-
Notifications
You must be signed in to change notification settings - Fork 405
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
Multiple programs besides the daemon run #63
Comments
Only one copy of the pigpio library is allowed to run at a time. The reason is that the library opens a rare resource, a DMA channel, and then starts sampling the GPIO at a high rate using that channel. It is possible to start pigpio and tell it to use a different DMA channel, but this use is prevented by the lock on /var/run/pigpio.pid. In extremis you could remove the lock code to allow multiple copies. In fact there are very few DMA channels left. Originally pigpio had about 13 channels (from 15) to select from, now its sometimes hard to find a free channel. There is very little you can do when directly linked with the library that you can't do just as well by using the daemon. If you do have such a need then I suggest you put all the time-critical code in one process and launch that instead of pigpiod. Your process then in effect becomes the pigpiod and will automatically service daemon requests via its socket and pipe interface (unless you disable those interfaces with gpioCfg* options at process start). |
Thanks for your detailed explanation! In fact, it is what I did yesterday. I moved any critical code into one process. I just wanted to ask and it makes totally sense. I must spread another thank-you for the great work you did on pigpio! |
BTW If you do run your program as a replacement for |
That should be automatic as the locking is actually handled by the library during initialisation. The code is initGrabLockFile in pigpio.c. |
Ah, I got that slightly wrong - my code is linked against |
Hi,
I have a question regarding a parallel usage of the daemon and other non-daemon programs at the same time. I use one program which writes via PWM through pigpiod to a pin and I have other programs which work on different pins at the same time. When the daemon runs, I get
Is it save to just write to a different pid file or are there any serious problems when doing this in parallel?
Thanks!
The text was updated successfully, but these errors were encountered: