- change prototype of async proc calls to
typedef int (*DoProcProc)(void *param);
i.e., have the proc return a result. Turned out that almost all
uses of the primop ended up encoding a result via their 'param'.
- when adding new I/O requests, shorten the time the IOManager
lock is held. Helps to keep down the size of the thread pool.
*/
tso->block_info.async_result->len = completedTable[i].len;
tso->block_info.async_result->errCode = completedTable[i].errCode;
*/
tso->block_info.async_result->len = completedTable[i].len;
tso->block_info.async_result->errCode = completedTable[i].errCode;
/* Drop the matched TSO from blocked_queue */
if (prev) {
prev->link = tso->link;
/* Drop the matched TSO from blocked_queue */
if (prev) {
prev->link = tso->link;
/* The procedure is assumed to encode result + success/failure
* via its param.
*/
/* The procedure is assumed to encode result + success/failure
* via its param.
*/
- work->workData.procData.proc(work->workData.procData.param);
- errCode=0;
+ errCode=work->workData.procData.proc(work->workData.procData.param);
#endif
if ( ioMan->workersIdle == 0 ) {
ioMan->numWorkers++;
#endif
if ( ioMan->workersIdle == 0 ) {
ioMan->numWorkers++;
+ LeaveCriticalSection(&ioMan->manLock);
NewIOWorkerThread(ioMan);
NewIOWorkerThread(ioMan);
+ } else {
+ LeaveCriticalSection(&ioMan->manLock);
- LeaveCriticalSection(&ioMan->manLock);
if (SubmitWork(ioMan->workQueue,wItem)) {
return wItem->requestID;
if (SubmitWork(ioMan->workQueue,wItem)) {
return wItem->requestID;
wItem->requestID = ioMan->requestID++;
EnterCriticalSection(&ioMan->manLock);
wItem->requestID = ioMan->requestID++;
EnterCriticalSection(&ioMan->manLock);
+#if 0
+ fprintf(stderr, "AddDelayRequest: %d\n", ioMan->workersIdle); fflush(stderr);
+#endif
if ( ioMan->workersIdle == 0 ) {
ioMan->numWorkers++;
if ( ioMan->workersIdle == 0 ) {
ioMan->numWorkers++;
+ LeaveCriticalSection(&ioMan->manLock);
NewIOWorkerThread(ioMan);
NewIOWorkerThread(ioMan);
+ } else {
+ LeaveCriticalSection(&ioMan->manLock);
- LeaveCriticalSection(&ioMan->manLock);
if (SubmitWork(ioMan->workQueue,wItem)) {
return wItem->requestID;
if (SubmitWork(ioMan->workQueue,wItem)) {
return wItem->requestID;
wItem->requestID = ioMan->requestID++;
EnterCriticalSection(&ioMan->manLock);
wItem->requestID = ioMan->requestID++;
EnterCriticalSection(&ioMan->manLock);
+#if 0
+ fprintf(stderr, "AddProcRequest: %d\n", ioMan->workersIdle); fflush(stderr);
+#endif
if ( ioMan->workersIdle == 0 ) {
ioMan->numWorkers++;
if ( ioMan->workersIdle == 0 ) {
ioMan->numWorkers++;
+ LeaveCriticalSection(&ioMan->manLock);
NewIOWorkerThread(ioMan);
NewIOWorkerThread(ioMan);
+ } else {
+ LeaveCriticalSection(&ioMan->manLock);
- LeaveCriticalSection(&ioMan->manLock);
if (SubmitWork(ioMan->workQueue,wItem)) {
return wItem->requestID;
if (SubmitWork(ioMan->workQueue,wItem)) {
return wItem->requestID;
-typedef void (*DoProcProc)(void *param);
+/*
+ * Asynchronous procedure calls executed by a worker thread
+ * take a generic state argument pointer and return an int by
+ * default.
+ */
+typedef int (*DoProcProc)(void *param);
typedef union workData {
struct {
typedef union workData {
struct {