Hello,

   That is how the cancelled event works on Linux.   I used this in the REPL
to interrupt an ongoing computation, see:

mono/mcs/tools/csharp/getline.cs

On Fri, May 20, 2011 at 6:41 AM, Weeble <[email protected]> wrote:

> What's a good way to write a cross-platform (for at least Windows and
> Linux, anyway) console app that terminates cleanly when the user
> presses ctrl+c? On Windows under .NET I can register an event-handler
> for Console.CancelKeyPressed. I assume this would work with Mono on
> Windows as well, but Mono on Linux doesn't seem to raise this event
> when the process receives SIGINT, which I would consider to be the
> analogous scenario. It looks like to handle SIGINT I would need to use
> Mono.Unix.UnixSignal from Mono.Posix. Can I write one assembly that
> does all of this? What's the best way to detect at run-time whether
> I'm running on Windows or Posix? Will anything bad happen on Windows
> (either at build-time or at run-time) if my assembly references
> Mono.Posix?
> _______________________________________________
> Mono-list maillist  -  [email protected]
> http://lists.ximian.com/mailman/listinfo/mono-list
>
_______________________________________________
Mono-list maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-list

Reply via email to