Skip to content

Commit a72c144

Browse files
committed
usleep was not working properly in msys1
1 parent 209ce0e commit a72c144

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ConEmuT.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ static int ce_forkpty(int *pmaster, int *pmaster_err, struct winsize *winp)
712712
{
713713
char *stdName, *errName;
714714
int newStd, newErr;
715-
int wait_steps = 0;
715+
DWORD tBegin, tEnd;
716716

717717
// To be sure we will not call these functions in child
718718
memset(&Connector, 0, sizeof(Connector));
@@ -727,10 +727,13 @@ static int ce_forkpty(int *pmaster, int *pmaster_err, struct winsize *winp)
727727
}
728728

729729
// Wait a little until parent process let us go
730-
while (!gb_sigusr1 && (++wait_steps < 2000))
731-
usleep(100);
730+
tBegin = GetTickCount();
731+
sleep(5);
732+
tEnd = GetTickCount();
732733
if (verbose)
733-
write_verbose("\033[33;40m\033[K{PID:%u} child process continues after %i waits for SIGUSR1\033[m\r\n", getpid(), wait_steps);
734+
{
735+
write_verbose("\033[33;40m\033[K{PID:%u} child process continues after %u ms (SIGUSR1=%u)\033[m\r\n", getpid(), (tEnd-tBegin), (gb_sigusr1?1:0));
736+
}
734737

735738
// TODO: tty_ioctl(TIOCSPGRP?)
736739

0 commit comments

Comments
 (0)