using System.Reflection.Emit;
using System.Diagnostics;
using System.Threading;
+using System.Threading.Tasks;
using System.Collections.Generic;
using System.Linq;
wait_one ();
return 0;
}
+ if (args.Length >0 && args [0] == "threadpool-io") {
+ threadpool_io ();
+ return 0;
+ }
breakpoints ();
single_stepping ();
arguments ();
public override string virtual_method () {
return "V2";
}
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void threadpool_io () {
+ Task<int> t = Task.Run (async () => {
+ var wc = new System.Net.WebClient ();
+ string filename = System.IO.Path.GetTempFileName ();
+
+ var dl = wc.DownloadFileTaskAsync ("http://www.mono-project.com/", filename);
+ await dl;
+ System.IO.File.Delete (filename);
+ return 1;
+ });
+ var n = t.Result;
+ }
}
class TypeLoadClass {
// Make sure we are still in the cctor
Assert.AreEqual (".cctor", e.Thread.GetFrames ()[0].Location.Method.Name);
}
+
+ [Test]
+ public void ThreadpoolIOsinglestep () {
+ // This is a regression test for #42625.
+ // It tests the interaction (particularly in coop GC of
+ // the threadpool I/O mechanism and the soft debugger.
+ Start (new string [] { "dtest-app.exe", "threadpool-io" });
+
+ Event e = run_until ("threadpool_io");
+ var req = create_step (e);
+ req.Enable ();
+
+ // step to start the task
+ e = step_once ();
+
+ req.Disable ();
+
+ // run until completion of the test method
+ e = step_out ();
+
+ vm.Resume ();
+
+ vm.Suspend ();
+ }
}
}
mono_gc_set_skip_thread (TRUE);
+ MONO_ENTER_GC_SAFE;
ready = epoll_wait (epoll_fd, epoll_events, EPOLL_NEVENTS, -1);
+ MONO_EXIT_GC_SAFE;
mono_gc_set_skip_thread (FALSE);
mono_gc_set_skip_thread (TRUE);
+ MONO_ENTER_GC_SAFE;
ready = kevent (kqueue_fd, NULL, 0, kqueue_events, KQUEUE_NEVENTS, NULL);
+ MONO_EXIT_GC_SAFE;
mono_gc_set_skip_thread (FALSE);
mono_gc_set_skip_thread (TRUE);
+ MONO_ENTER_GC_SAFE;
ready = mono_poll (poll_fds, poll_fds_size, -1);
+ MONO_EXIT_GC_SAFE;
mono_gc_set_skip_thread (FALSE);