V70+: #282 close notification sockets when pigpiod "-m" option is used.
authorjoan2937 <joan@abyz.me.uk>
Thu, 15 Aug 2019 15:26:18 +0000 (16:26 +0100)
committerjoan2937 <joan@abyz.me.uk>
Thu, 15 Aug 2019 15:26:18 +0000 (16:26 +0100)
pigpio.c
pigpio.h

index d78afd62209f1d878c97aef0805c1c49c20e9f46..7f8b72e316fc63dc30f0b07c99ed910f737f33a3 100644 (file)
--- a/pigpio.c
+++ b/pigpio.c
@@ -11958,6 +11958,8 @@ int gpioNotifyPause (unsigned handle)
 
 int gpioNotifyClose(unsigned handle)
 {
+   char fifo[32];
+
    DBG(DBG_USER, "handle=%d", handle);
 
    CHECK_INITED;
@@ -11974,7 +11976,24 @@ int gpioNotifyClose(unsigned handle)
 
    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;
 }
index 2891c8728e2486d88dbb872297c5d8d0cf1aa85d..524a2f5b7a3525316ff9bfd906d468830af91dae 100644 (file)
--- a/pigpio.h
+++ b/pigpio.h
@@ -30,7 +30,7 @@ For more information, please refer to <http://unlicense.org/>
 #include <stdint.h>
 #include <pthread.h>
 
-#define PIGPIO_VERSION 70
+#define PIGPIO_VERSION 7008
 
 /*TEXT