projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
vectoriser: fix warning
[ghc-hetmet.git]
/
rts
/
win32
/
IOManager.c
diff --git
a/rts/win32/IOManager.c
b/rts/win32/IOManager.c
index
6e7cd25
..
c9a759f
100644
(file)
--- a/
rts/win32/IOManager.c
+++ b/
rts/win32/IOManager.c
@@
-16,6
+16,7
@@
#include <io.h>
#include <winsock.h>
#include <process.h>
#include <io.h>
#include <winsock.h>
#include <process.h>
+#include <errno.h>
/*
* Internal state maintained by the IO manager.
/*
* Internal state maintained by the IO manager.
@@
-181,7
+182,15
@@
IOWorkerProc(PVOID param)
len = write(work->workData.ioData.fd,
work->workData.ioData.buf,
work->workData.ioData.len);
len = write(work->workData.ioData.fd,
work->workData.ioData.buf,
work->workData.ioData.len);
- if (len == -1) { errCode = errno; }
+ if (len == -1) {
+ errCode = errno;
+ // write() gets errno wrong for
+ // ERROR_NO_DATA, we have to fix it here:
+ if (errCode == EINVAL &&
+ GetLastError() == ERROR_NO_DATA) {
+ errCode = EPIPE;
+ }
+ }
}
complData = work->workData.ioData.buf;
fd = work->workData.ioData.fd;
}
complData = work->workData.ioData.buf;
fd = work->workData.ioData.fd;
@@
-461,6
+470,8
@@
void ShutdownIOManager ( rtsBool wait_threads )
}
FreeWorkQueue(ioMan->workQueue);
CloseHandle(ioMan->hExitEvent);
}
FreeWorkQueue(ioMan->workQueue);
CloseHandle(ioMan->hExitEvent);
+ DeleteCriticalSection(&ioMan->active_work_lock);
+ DeleteCriticalSection(&ioMan->manLock);
free(ioMan);
ioMan = NULL;
}
free(ioMan);
ioMan = NULL;
}