@@ -101,7 +101,17 @@ class SignalWrap : public HandleWrap {
101101      }
102102    }
103103#endif 
104-     int  err = uv_signal_start (&wrap->handle_ , OnSignal, signum);
104+     int  err = uv_signal_start (
105+         &wrap->handle_ ,
106+         [](uv_signal_t * handle, int  signum) {
107+           SignalWrap* wrap = ContainerOf (&SignalWrap::handle_, handle);
108+           Environment* env = wrap->env ();
109+           HandleScope handle_scope (env->isolate ());
110+           Context::Scope context_scope (env->context ());
111+           Local<Value> arg = Integer::New (env->isolate (), signum);
112+           wrap->MakeCallback (env->onsignal_string (), 1 , &arg);
113+         },
114+         signum);
105115    args.GetReturnValue ().Set (err);
106116  }
107117
@@ -112,16 +122,6 @@ class SignalWrap : public HandleWrap {
112122    args.GetReturnValue ().Set (err);
113123  }
114124
115-   static  void  OnSignal (uv_signal_t * handle, int  signum) {
116-     SignalWrap* wrap = ContainerOf (&SignalWrap::handle_, handle);
117-     Environment* env = wrap->env ();
118-     HandleScope handle_scope (env->isolate ());
119-     Context::Scope context_scope (env->context ());
120- 
121-     Local<Value> arg = Integer::New (env->isolate (), signum);
122-     wrap->MakeCallback (env->onsignal_string (), 1 , &arg);
123-   }
124- 
125125  uv_signal_t  handle_;
126126};
127127
0 commit comments