V70+: #282 close notification sockets when pigpiod "-m" option is used.

This commit is contained in:
joan2937 2019-08-15 16:26:18 +01:00
parent 21859bf092
commit 331b5a1451
2 changed files with 21 additions and 2 deletions

View File

@ -11958,6 +11958,8 @@ int gpioNotifyPause (unsigned handle)
int gpioNotifyClose(unsigned handle) int gpioNotifyClose(unsigned handle)
{ {
char fifo[32];
DBG(DBG_USER, "handle=%d", handle); DBG(DBG_USER, "handle=%d", handle);
CHECK_INITED; CHECK_INITED;
@ -11974,7 +11976,24 @@ int gpioNotifyClose(unsigned handle)
intNotifyBits(); intNotifyBits();
/* actual close done in alert thread */ if (gpioCfg.ifFlags & PI_DISABLE_ALERT)
{
if (gpioNotify[handle].pipe)
{
DBG(DBG_INTERNAL, "close notify pipe %d", gpioNotify[handle].fd);
close(gpioNotify[handle].fd);
sprintf(fifo, "/dev/pigpio%d", handle);
unlink(fifo);
}
gpioNotify[handle].state = PI_NOTIFY_CLOSED;
}
else
{
/* actual close done in alert thread */
}
return 0; return 0;
} }

View File

@ -30,7 +30,7 @@ For more information, please refer to <http://unlicense.org/>
#include <stdint.h> #include <stdint.h>
#include <pthread.h> #include <pthread.h>
#define PIGPIO_VERSION 70 #define PIGPIO_VERSION 7008
/*TEXT /*TEXT