Cygwin: pty: Fix acquiring attach_mutex timing.
- When temporarily attaching a console, the timing of acquiring attach_mutex was not appropriate. This sometimes caused master forwarding thread to crash on Ctrl-C in Windows 7. This patch fixes the issue.
This commit is contained in:
parent
aa9b5262f2
commit
b29fd96cac
|
@ -4171,13 +4171,13 @@ DWORD
|
||||||
fhandler_pty_common::attach_console_temporarily (DWORD target_pid)
|
fhandler_pty_common::attach_console_temporarily (DWORD target_pid)
|
||||||
{
|
{
|
||||||
DWORD resume_pid = 0;
|
DWORD resume_pid = 0;
|
||||||
|
acquire_attach_mutex (mutex_timeout);
|
||||||
pinfo pinfo_resume (myself->ppid);
|
pinfo pinfo_resume (myself->ppid);
|
||||||
if (pinfo_resume)
|
if (pinfo_resume)
|
||||||
resume_pid = pinfo_resume->dwProcessId;
|
resume_pid = pinfo_resume->dwProcessId;
|
||||||
if (!resume_pid)
|
if (!resume_pid)
|
||||||
resume_pid = get_console_process_id (myself->dwProcessId, false);
|
resume_pid = get_console_process_id (myself->dwProcessId, false);
|
||||||
bool console_exists = fhandler_console::exists ();
|
bool console_exists = fhandler_console::exists ();
|
||||||
acquire_attach_mutex (mutex_timeout);
|
|
||||||
if (!console_exists || resume_pid)
|
if (!console_exists || resume_pid)
|
||||||
{
|
{
|
||||||
FreeConsole ();
|
FreeConsole ();
|
||||||
|
|
Loading…
Reference in New Issue