projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add sysErrorBelch() for reporting system call errors
[ghc-hetmet.git]
/
rts
/
win32
/
IOManager.c
diff --git
a/rts/win32/IOManager.c
b/rts/win32/IOManager.c
index
e69b8bc
..
2123b8c
100644
(file)
--- a/
rts/win32/IOManager.c
+++ b/
rts/win32/IOManager.c
@@
-220,10
+220,16
@@
IOWorkerProc(PVOID param)
free(work);
} else {
fprintf(stderr, "unable to fetch work; fatal.\n"); fflush(stderr);
free(work);
} else {
fprintf(stderr, "unable to fetch work; fatal.\n"); fflush(stderr);
+ EnterCriticalSection(&iom->manLock);
+ ioMan->numWorkers--;
+ LeaveCriticalSection(&iom->manLock);
return 1;
}
} else {
fprintf(stderr, "waiting failed (%lu); fatal.\n", rc); fflush(stderr);
return 1;
}
} else {
fprintf(stderr, "waiting failed (%lu); fatal.\n", rc); fflush(stderr);
+ EnterCriticalSection(&iom->manLock);
+ ioMan->numWorkers--;
+ LeaveCriticalSection(&iom->manLock);
return 1;
}
}
return 1;
}
}
@@
-334,14
+340,12
@@
depositWorkItem( unsigned int reqID,
if ( (ioMan->workersIdle < ioMan->queueSize) ) {
/* No, go ahead and create another. */
ioMan->numWorkers++;
if ( (ioMan->workersIdle < ioMan->queueSize) ) {
/* No, go ahead and create another. */
ioMan->numWorkers++;
- LeaveCriticalSection(&ioMan->manLock);
- NewIOWorkerThread(ioMan);
- } else {
- LeaveCriticalSection(&ioMan->manLock);
+ if (!NewIOWorkerThread(ioMan)) {
+ ioMan->numWorkers--;
+ }
}
}
- } else {
- LeaveCriticalSection(&ioMan->manLock);
}
}
+ LeaveCriticalSection(&ioMan->manLock);
if (SubmitWork(ioMan->workQueue,wItem)) {
/* Note: the work item has potentially been consumed by a worker thread
if (SubmitWork(ioMan->workQueue,wItem)) {
/* Note: the work item has potentially been consumed by a worker thread