Mono.Unix.UnixSignal.Reset C# (CSharp) Méthode

Reset() public méthode

public Reset ( ) : bool
Résultat bool
		public unsafe bool Reset ()
		{
			int n = Interlocked.Exchange (ref Info->count, 0);
			return n != 0;
		}

Usage Example

Exemple #1
0
		public static int Main (string[] args)
		{
			using (ServiceHost host = new ServiceHost (typeof (HangmanService)))
			{
				var security = new SecurityMode ();
				host.AddServiceEndpoint (
					typeof(IHangmanService),
					new WSHttpBinding (security, true),
					"http://localhost:8325/");

				host.Open ();

				/*
				Console.WriteLine ("Type [CR] to stop ...");
				Console.ReadKey ();
				*/

				/* Demon */
				UnixSignal sigint = new UnixSignal (Signum.SIGINT);
				UnixSignal sigterm = new UnixSignal (Signum.SIGTERM);
				UnixSignal sighup = new UnixSignal (Signum.SIGHUP);
				UnixSignal sigusr2 = new UnixSignal (Signum.SIGUSR2);
				UnixSignal [] signals = new UnixSignal[]
					{
						sigint,
						sigterm,
						sighup,
						sigusr2
					};

				bool exit = false;
				while (!exit)
				{
					int id = UnixSignal.WaitAny (signals);

					if (id >= 0 && id < signals.Length)
					{
						if (sigint.IsSet || sigterm.IsSet)
						{
							sigint.Reset ();
							sigterm.Reset ();
							exit = true;
						} else if (sighup.IsSet)
							sighup.Reset ();
						else if (sigusr2.IsSet)
							sighup.Reset ();

					}
				}
				/* Demon */

				host.Close ();
			}

			return 0;
		}
All Usage Examples Of Mono.Unix.UnixSignal::Reset