fix bug related to sleeping and Windows networking (take 3)

svn: r14056
This commit is contained in:
Matthew Flatt 2009-03-11 18:40:32 +00:00
parent a701c4f426
commit a4c344228d
2 changed files with 23 additions and 2 deletions

View File

@ -986,7 +986,12 @@ void MrEdMSWSleep(float secs, void *fds)
}
if (th2) {
closesocket(fake);
while (closesocket(fake)) {
/* I don't think WSAEINPROGRESS should happen, but just in case... */
if (WSAGetLastError() != WSAEINPROGRESS)
break;
}
scheme_interrupt_win32_thread(th2);
WaitForSingleObject(th2, INFINITE);
scheme_forget_thread(thread_memory);
CloseHandle(th2);

View File

@ -4607,6 +4607,16 @@ static CSI_proc get_csi(void)
END_XFORM_SKIP;
return csi;
}
MZ_EXTERN void scheme_interrupt_win32_thread(HANDLE th);
void scheme_interrupt_win32_thread(HANDLE th)
{
CSI_proc csi;
csi = get_csi();
if (csi)
csi(th);
}
# endif
/* forward decl: */
@ -8104,7 +8114,13 @@ static void default_sleep(float v, void *fds)
clean_up_wait(result, array, rps, count);
/* cause selector thread to end: */
closesocket(fake);
while (closesocket(fake)) {
/* I don't think WSAEINPROGRESS should happen, but just in case... */
if (WSAGetLastError() != WSAEINPROGRESS)
break;
}
scheme_interrupt_win32_thread(th);
WaitForSingleObject(th, INFINITE);
scheme_forget_thread(thread_memory);