[PATCH] Cygwin: dsp: Fix a bug that app hangs if it killed during write().

Takashi Yano takashi.yano@nifty.ne.jp
Sun Sep 17 13:07:55 GMT 2023


If app is killed during blocking write(), it sometimes hangs. This
patch fixes the issue.

Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
---
 winsup/cygwin/fhandler/dsp.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/fhandler/dsp.cc b/winsup/cygwin/fhandler/dsp.cc
index 5f78821d4..03c812a9c 100644
--- a/winsup/cygwin/fhandler/dsp.cc
+++ b/winsup/cygwin/fhandler/dsp.cc
@@ -590,7 +590,8 @@ fhandler_dev_dsp::Audio_out::waitforallsent ()
   while (Qisr2app_->query () != fh->fragstotal_)
     {
       debug_printf ("%d blocks in Qisr2app", Qisr2app_->query ());
-      Sleep (100);
+      cygwait (1);
+      sendcurrent ();
     }
 }
 
-- 
2.39.0



More information about the Cygwin-patches mailing list