summaryrefslogtreecommitdiff
path: root/lib/ReadJob.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ReadJob.cc')
-rw-r--r--lib/ReadJob.cc10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/ReadJob.cc b/lib/ReadJob.cc
index 3083040..d5cabca 100644
--- a/lib/ReadJob.cc
+++ b/lib/ReadJob.cc
@@ -2,8 +2,9 @@
#include "HttpServ.h"
ReadJob::ReadJob(Handle * as, Handle * ad) : s(as), d(ad) {
- WaitFor(s, W4_STICKY | W4_READING);
- WaitFor(d, W4_STICKY | W4_WRITING);
+ s->SetNonBlock();
+ d->SetNonBlock();
+ WaitFor(s, W4_READING);
}
ReadJob::~ReadJob() { }
@@ -17,6 +18,7 @@ int ReadJob::Do() throw (GeneralException) {
*s >> buff;
}
catch (IOAgain e) {
+ WaitFor(s, W4_READING);
Suspend(TASK_ON_HOLD);
}
case 1:
@@ -25,13 +27,15 @@ int ReadJob::Do() throw (GeneralException) {
}
catch (IOAgain e) {
current = 1;
- throw TaskSwitch();
+ WaitFor(d, W4_WRITING);
+ Suspend(TASK_ON_HOLD);
}
current = 0;
if (buff == "") return TASK_DONE;
}
if (!s->IsClosed()) {
+ WaitFor(s, W4_READING);
Suspend(TASK_ON_HOLD);
}