mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-03-04 14:06:13 +08:00
Cygwin: pty: Fix input switching failure.
- This patch fixes the failure of input switching between io_handle and io_handle_nat. This very rarely happens, however, input is wrongly switched to io_handle_nat even though the non-cygwin app is in the background.
This commit is contained in:
parent
54756529d4
commit
0449a29ac0
@ -1056,6 +1056,7 @@ fhandler_pty_slave::set_switch_to_pcon (void)
|
|||||||
isHybrid = true;
|
isHybrid = true;
|
||||||
setup_locale ();
|
setup_locale ();
|
||||||
myself->exec_dwProcessId = myself->dwProcessId;
|
myself->exec_dwProcessId = myself->dwProcessId;
|
||||||
|
myself->process_state |= PID_NEW_PG; /* Marker for pcon_fg */
|
||||||
bool nopcon = (disable_pcon || !term_has_pcon_cap (NULL));
|
bool nopcon = (disable_pcon || !term_has_pcon_cap (NULL));
|
||||||
WaitForSingleObject (pcon_mutex, INFINITE);
|
WaitForSingleObject (pcon_mutex, INFINITE);
|
||||||
bool pcon_enabled = setup_pseudoconsole (nopcon);
|
bool pcon_enabled = setup_pseudoconsole (nopcon);
|
||||||
@ -1168,6 +1169,7 @@ fhandler_pty_slave::reset_switch_to_pcon (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
myself->exec_dwProcessId = 0;
|
myself->exec_dwProcessId = 0;
|
||||||
|
myself->process_state &= ~PID_NEW_PG;
|
||||||
isHybrid = false;
|
isHybrid = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2272,6 +2274,7 @@ fhandler_pty_master::write (const void *ptr, size_t len)
|
|||||||
_pinfo *p = pids[i];
|
_pinfo *p = pids[i];
|
||||||
if (p->ctty == get_ttyp ()->ntty
|
if (p->ctty == get_ttyp ()->ntty
|
||||||
&& p->pgid == get_ttyp ()->getpgid ()
|
&& p->pgid == get_ttyp ()->getpgid ()
|
||||||
|
&& (p->process_state & PID_NOTCYGWIN)
|
||||||
&& (p->process_state & PID_NEW_PG))
|
&& (p->process_state & PID_NEW_PG))
|
||||||
{
|
{
|
||||||
wpid = p->dwProcessId;
|
wpid = p->dwProcessId;
|
||||||
|
@ -392,7 +392,8 @@ tty::pcon_fg (pid_t pgid)
|
|||||||
for (unsigned i = 0; i < pids.npids; i++)
|
for (unsigned i = 0; i < pids.npids; i++)
|
||||||
{
|
{
|
||||||
_pinfo *p = pids[i];
|
_pinfo *p = pids[i];
|
||||||
if (p->ctty == ntty && p->pgid == pgid && p->exec_dwProcessId)
|
if (p->ctty == ntty && p->pgid == pgid
|
||||||
|
&& (p->process_state & (PID_NOTCYGWIN | PID_NEW_PG)))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (pgid > MAX_PID)
|
if (pgid > MAX_PID)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user