* (c) sof, 2002-2003.
*/
#include "Rts.h"
+#include "RtsUtils.h"
#include <windows.h>
#include <stdio.h>
#include "Schedule.h"
static void
onIOComplete(unsigned int reqID,
- void* param STG_UNUSED,
int fd STG_UNUSED,
int len,
- char* buf STG_UNUSED,
+ void* buf STG_UNUSED,
int errCode)
{
/* Deposit result of request in queue/table */
#if 0
fprintf(stderr, "addIOReq: %d %d %d\n", fd, forWriting, len); fflush(stderr);
#endif
- return AddIORequest(fd,forWriting,isSock,len,buf,0,onIOComplete);
+ return AddIORequest(fd,forWriting,isSock,len,buf,onIOComplete);
}
unsigned int
-addDelayRequest(int msecs)
+addDelayRequest(int msecs)
{
EnterCriticalSection(&queue_lock);
issued_reqs++;
LeaveCriticalSection(&queue_lock);
#if 0
- fprintf(stderr, "addDelayReq: %d %d %d\n", msecs); fflush(stderr);
+ fprintf(stderr, "addDelayReq: %d\n", msecs); fflush(stderr);
#endif
- return AddDelayRequest(msecs,0,onIOComplete);
+ return AddDelayRequest(msecs,onIOComplete);
}
+unsigned int
+addDoProcRequest(void* proc, void* param)
+{
+ EnterCriticalSection(&queue_lock);
+ issued_reqs++;
+ LeaveCriticalSection(&queue_lock);
+#if 0
+ fprintf(stderr, "addProcReq: %p %p\n", proc, param); fflush(stderr);
+#endif
+ return AddProcRequest(proc,param,onIOComplete);
+}
+
+
int
startupAsyncIO()
{
prev = NULL;
for(tso = blocked_queue_hd ; tso != END_TSO_QUEUE; tso = tso->link) {
switch(tso->why_blocked) {
- case BlockedOnDelay:
case BlockedOnRead:
case BlockedOnWrite:
+ case BlockedOnDoProc:
if (tso->block_info.async_result->reqID == rID) {
/* Found the thread blocked waiting on request; stodgily fill
* in its result block.
*/
- if (tso->why_blocked != BlockedOnDelay) {
- 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) {
}
break;
default:
+ if (tso->why_blocked != NotBlocked) {
+ barf("awaitRequests: odd thread state");
+ }
break;
}
prev = tso;