]> sourceware.org Git - lvm2.git/commitdiff
dmeventd: handle signal from plugin
authorZdenek Kabelac <zkabelac@redhat.com>
Thu, 22 Oct 2015 13:48:14 +0000 (15:48 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Thu, 22 Oct 2015 20:40:07 +0000 (22:40 +0200)
Add support to unmonitor device when monitor recognizes there is
nothing to monitor anymore.

TODO: possibly API change with return value could be also used.

WHATS_NEW_DM
daemons/dmeventd/dmeventd.c

index 8c271391dd7d2b27523313d1a6de1affa67d78c7..8524a6de820973e694217d6662ae31c121c1496a 100644 (file)
@@ -1,6 +1,7 @@
 Version 1.02.110 - 
 ======================================
-  New design for thread cooperation in dmeventd.
+  Add support to allow unmonitor device from plugin itself.
+  New design for thread co-operation in dmeventd.
   Dmeventd read device status with 'noflush'.
   Dmeventd closes control device when no device is monitored.
   Thin plugin for dmeventd improved percentage usage.
index d8c317e8e661b2d43ef6b1c41062e9b23e080ff3..2706ad60f3669c0ac279bd247aa6692c0d223daa 100644 (file)
@@ -973,6 +973,17 @@ static void *_monitor_thread(void *arg)
 
                        _lock_mutex();
                        thread->processing = 0;
+
+                       /*
+                        * Thread can terminate itself from plugin via SIGALRM
+                        * Timer thread will not send signal while processing
+                        * TODO: maybe worth API change and return value for
+                        *       _do_process_event() instead of this signal solution
+                        */
+                       if (sigpending(&pendmask) < 0)
+                               log_sys_error("sigpending", "");
+                       else if (sigismember(&pendmask, SIGALRM))
+                               break;
                } else {
                        _unlock_mutex();
 
This page took 0.183355 seconds and 5 git commands to generate.