[New msys2-runtime version] Cygwin: console: Abort setting disable_master_thread when no con.owner
Cygwin: console: Abort setting disable_master_thread when no con.owner
With the commit 733d5a953fa9 ("Cygwin: console: Ensure the master
thread runs only when it is supposed to"), the process which calls
set_disable_master_thread() hangs if the con.owner already exited,
because set_disable_master_thread() waits for cons_master_thread
accepting the status change and reflecting the current status to
master_thread_suspended. With this patch, set_disable_master_thread()
is aborted if the owner process no longer exists to avoid this
hang.
Backport the complete upstream v5 patch unchanged after v18:
https://inbox.sourceware.org/cygwin-patches/20260923223230.3504-1-takashi.yano@nifty.ne.jp/
Addresses: https://cygwin.com/pipermail/cygwin/2026-September/260037.html
Fixes: 733d5a953fa9 ("Cygwin: console: Ensure the master thread runs only when it is supposed to")
Reported-by: Jay Libove Alzina <libove@felines.org>
Co-authored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Assisted-by: GPT-6
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
msys2/msys2-runtime@c770e1b
[New msys2-runtime version] Cygwin: console: Fix undesired mode change at exit of non-cygwin apps
Cygwin: console: Fix undesired mode change at exit of non-cygwin apps
Previously, if two non-cygwin apps are started and one of them
exits first, the other one lost appropriate console mode, since
the first one restored it to tty::cygwin. This patch counts the
active console process whose pgid is pgid of the tty and if the
result is zero (means the last non-cygwin foreground process),
restore console mode. To avoid race issue between apps modifying
console mode simultaneously, this patch also introduce a mutex
named `cons_mode_mutex`.
Known limitation:
In the case of non-overlayed spawn, there still exists a small
window in which another non-cygwin process may restore tty::cygwin
mode even though new non-cygwin app is about to start.
In addition:
Avoid the cleanup/startup deadlock: cleanup can hold `cons_mode_mutex`
while waiting for a console master that a new owner cannot start until
acquiring that mutex. Startup must precede the mode-mutex wait without
changing the handshake or mode serialization.
Backport the complete upstream v18 patch after the prerequisite:
https://inbox.sourceware.org/cygwin-patches/20260919004709.26360-1-takashi.yano@nifty.ne.jp/
Adapt only the three existing msys2-3.6.10 preimage/context spellings.
Fixes: 48285aa36c2c ("Cygwin: console: Fix handling of Ctrl-S in Win7.")
Co-authored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Reviewed-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Assisted-by: GPT-6
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
msys2/msys2-runtime@92c1e00
[New msys2-runtime version] Cygwin: console: Abort setting disable_master_thread when no con.owner
msys2/msys2-runtime@c770e1b
[New msys2-runtime version] Cygwin: console: Fix undesired mode change at exit of non-cygwin apps
msys2/msys2-runtime@92c1e00