Exemplo n.º 1
0
 public UnixSignal(Mono.Unix.Native.Signum signum)
 {
     this.signum      = NativeConvert.FromSignum(signum);
     this.signal_info = UnixSignal.install(this.signum);
     if (this.signal_info == IntPtr.Zero)
     {
         throw new ArgumentException("Unable to handle signal", "signum");
     }
 }
Exemplo n.º 2
0
        private static void CheckSignal()
        {
            Mono.Unix.UnixSignal[] signals = new Mono.Unix.UnixSignal[] {
                new Mono.Unix.UnixSignal(Mono.Unix.Native.Signum.SIGINT)
            };

            int index = Mono.Unix.UnixSignal.WaitAny(signals);

            Mono.Unix.Native.Signum signum = signals[index].Signum;
            if (signum == Mono.Unix.Native.Signum.SIGINT)
            {
                if (service != null)
                {
                    service.Dispose();
                    service = null;
                }
            }
        }