소스 검색

Fixes issue #306 async/await hang (#312)

* Fixed async/await hang

* Fixed async/await hang with calling Wakeup

* Moved Wake Up into lock statement
BDisp 5 년 전
부모
커밋
0c72b8eae1
2개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 1 1
      Terminal.Gui/Core.cs
  2. 3 1
      Terminal.Gui/MonoCurses/mainloop.cs

+ 1 - 1
Terminal.Gui/Core.cs

@@ -1717,7 +1717,7 @@ namespace Terminal.Gui {
 
 			public override void Post (SendOrPostCallback d, object state)
 			{
-				mainLoop.AddIdle (() => { 
+				mainLoop.AddIdle (() => {
 					d (state);
 					return false;
 				});

+ 3 - 1
Terminal.Gui/MonoCurses/mainloop.cs

@@ -354,8 +354,10 @@ namespace Mono.Terminal {
 		/// </summary>
 		public Func<bool> AddIdle (Func<bool> idleHandler)
 		{
-			lock (idleHandlers)
+			lock (idleHandlers) {
 				idleHandlers.Add (idleHandler);
+				driver.Wakeup ();
+			}
 			return idleHandler;
 		}