[Mono-bugs] [Bug 312172] [2.0] BeginRead on console input blocks program exit
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Mon Apr 20 08:23:32 EDT 2009
http://bugzilla.novell.com/show_bug.cgi?id=312172
User bhenderson at ipswitch.com added comment
http://bugzilla.novell.com/show_bug.cgi?id=312172#c2
Ben Henderson <bhenderson at ipswitch.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bhenderson at ipswitch.com
Version|unspecified |2.4.x
--- Comment #2 from Ben Henderson <bhenderson at ipswitch.com> 2009-04-20 06:23:31 MDT ---
I have also run into this bug... Running Mono 2.4 in verbose mode, the call
stack seems to indicate that BeginRead is calling Read. Would be a nice to
have. ;)
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Threading;
namespace async_stdin
{
class Program
{
protected Stream inputStream;
protected volatile bool exitProcess = false;
public void Test()
{
inputStream = Console.OpenStandardInput();
if (inputStream != null)
{
inputStream.BeginRead(new byte[1], 0, 1, new
AsyncCallback(KeyboardInputCallback), null);
Console.WriteLine("Press a key to exit...");
while (! exitProcess)
{
Console.WriteLine("Processing...");
Thread.Sleep(1000);
}
Console.WriteLine("Shutting down...");
}
}
protected void KeyboardInputCallback(IAsyncResult asyncResult)
{
Console.WriteLine("User pressed a key... time to exit");
exitProcess = true;
}
static void Main(string[] args)
{
Program prg = new Program();
prg.Test();
}
}
}
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list