summaryrefslogtreecommitdiff
path: root/lib/TaskMan.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/TaskMan.cc')
-rw-r--r--lib/TaskMan.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/TaskMan.cc b/lib/TaskMan.cc
index 218ce2f..546bbc6 100644
--- a/lib/TaskMan.cc
+++ b/lib/TaskMan.cc
@@ -92,9 +92,7 @@ void TaskMan::RemoveFromWatches(Task * t) {
}
void TaskMan::WaitFor(Handle * h, Task * t, int flags) {
- if (h->GetHandle() >= 0) {
- w4ha.push_back(w4ha_t(h, flags, t));
- }
+ w4ha.push_back(w4ha_t(h, flags, t));
}
void TaskMan::WaitFor(pid_t p, Task * t) {
@@ -174,8 +172,13 @@ void TaskMan::MainLoop() throw (GeneralException) {
q->events = 0;
} else {
cerr << "==== TaskMan: adding watch over handle \"" << p->ha->GetName() << "\" for task \"" << p->T->GetName() << "\"\n";
- q->fd = p->ha->GetHandle();
- q->events = (p->flags & W4_READING ? POLLIN : 0) | (p->flags & W4_WRITING ? POLLOUT : 0);
+ if (p->ha->CanWatch() {
+ q->fd = p->ha->GetHandle();
+ q->events = (p->flags & W4_READING ? POLLIN : 0) | (p->flags & W4_WRITING ? POLLOUT : 0);
+ } else {
+ cerr << "==== TaskMan: handle can't watch, switching task to burst.\n";
+ p->T->SetBurst();
+ }
}
}