Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLudovic Henry <ludovic@xamarin.com>2017-12-01 23:06:22 +0300
committerMarek Safar <marek.safar@gmail.com>2017-12-14 13:14:26 +0300
commit5e9081600f0cd4a66e7ff1d274109869b811a5b3 (patch)
tree61a25846fe431124ebb6e6a8529f95656847a526 /mcs/class/corlib
parentcd09ddbc55c9866703d43fb8b089978dec2c4ef3 (diff)
[console] Invoke async console cancel on ThreadPool from managed
Diffstat (limited to 'mcs/class/corlib')
-rw-r--r--mcs/class/corlib/LinkerDescriptor/mscorlib.xml5
-rw-r--r--mcs/class/corlib/System/Console.cs17
2 files changed, 12 insertions, 10 deletions
diff --git a/mcs/class/corlib/LinkerDescriptor/mscorlib.xml b/mcs/class/corlib/LinkerDescriptor/mscorlib.xml
index 4d36758a43c..9aa1feff102 100644
--- a/mcs/class/corlib/LinkerDescriptor/mscorlib.xml
+++ b/mcs/class/corlib/LinkerDescriptor/mscorlib.xml
@@ -464,6 +464,11 @@
<method name=".ctor" />
</type>
+ <!-- console-unix.c: do_console_cancel_event -->
+ <type fullname="System.Console">
+ <method name="DoConsoleCancelEventInBackground" />
+ </type>
+
<!-- icalls - but (at least parts of them) are used thru interfaces at runtime and cannot be linked out -->
<type fullname="System.Globalization.DateTimeFormatInfo" preserve="fields" />
<type fullname="System.Globalization.CompareInfo" preserve="fields" />
diff --git a/mcs/class/corlib/System/Console.cs b/mcs/class/corlib/System/Console.cs
index 52a43abf1df..aa0d8fca91c 100644
--- a/mcs/class/corlib/System/Console.cs
+++ b/mcs/class/corlib/System/Console.cs
@@ -36,6 +36,7 @@ using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Text;
+using System.Threading;
namespace System
{
@@ -751,16 +752,12 @@ namespace System
}
}
- delegate void InternalCancelHandler ();
-
-#pragma warning disable 414
- //
- // Used by console-io.c
- //
- static readonly InternalCancelHandler cancel_handler = new InternalCancelHandler (DoConsoleCancelEvent);
-#pragma warning restore 414
-
- internal static void DoConsoleCancelEvent ()
+ static void DoConsoleCancelEventInBackground ()
+ {
+ ThreadPool.UnsafeQueueUserWorkItem (_ => DoConsoleCancelEvent(), null);
+ }
+
+ static void DoConsoleCancelEvent ()
{
bool exit = true;
if (cancel_event != null) {