pecl-ev / watcher.h

Diff from to

watcher.h

 
 #define PHP_EV_CHECK_SIGNAL_CAN_START(w)                                                   \
     do {                                                                                   \
-        /* Pulled this part from EV module of Perl */                                      \
-        if (signals [(w)->signum - 1].loop                                                 \
-                && signals [(w)->signum - 1].loop != php_ev_watcher_loop_ptr(w)) {         \
+        struct ev_loop *tmp_loop = MyG(signal_loops[(w)->signum - 1]);                     \
+        if (tmp_loop && tmp_loop != php_ev_watcher_loop_ptr(w)) {                          \
             php_error_docref(NULL TSRMLS_CC, E_WARNING,                                    \
                     "Can't start signal watcher, signal %d already "                       \
-                    "registered in another loop", w->signum);                              \
+                    "registered for another loop", (w)->signum);                           \
+            return;                                                                        \
         }                                                                                  \
     } while (0)
 
 #define PHP_EV_SIGNAL_START(w)                                                             \
     do {                                                                                   \
-        PHP_EV_CHECK_SIGNAL_CAN_START(w);                                                  \
-        PHP_EV_WATCHER_START(ev_signal, w);                                                \
+        PHP_EV_CHECK_SIGNAL_CAN_START(((ev_signal *) (w)));                                \
+        MyG(signal_loops[(w)->signum - 1]) = php_ev_watcher_loop_ptr((w));                 \
+        PHP_EV_WATCHER_START(ev_signal, (w));                                              \
+    } while (0)
+
+#define PHP_EV_SIGNAL_STOP(w)                                                              \
+    do {                                                                                   \
+        MyG(signal_loops[(w)->signum - 1]) = 0;                                            \
+        PHP_EV_WATCHER_STOP(ev_signal, (w));                                               \
     } while (0)
 
 #define PHP_EV_SIGNAL_RESET(w, seta)                                                       \
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.