diff options
author | Pixel <Pixel> | 2001-11-27 15:10:33 +0000 |
---|---|---|
committer | Pixel <Pixel> | 2001-11-27 15:10:33 +0000 |
commit | 76b2e3c19278da49193aa1599a35197b279b4439 (patch) | |
tree | 01a9c64a71a7e4568b5f0ad5db3077e0c0311b08 /lib | |
parent | 29f8cedf68c5e45ca20078a2a34a07875d7dea5b (diff) |
Bug in taskman...
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Buffer.cc | 4 | ||||
-rw-r--r-- | lib/CopyJob.cc | 4 | ||||
-rw-r--r-- | lib/Handle.cc | 4 | ||||
-rw-r--r-- | lib/ReadJob.cc | 4 | ||||
-rw-r--r-- | lib/TaskMan.cc | 13 |
5 files changed, 20 insertions, 9 deletions
diff --git a/lib/Buffer.cc b/lib/Buffer.cc index afbaa6f..2c2c955 100644 --- a/lib/Buffer.cc +++ b/lib/Buffer.cc @@ -71,3 +71,7 @@ Buffer Buffer::operator=(const Buffer & b) { } return *this; } + +bool Buffer::CanWatch() { + return false; +} diff --git a/lib/CopyJob.cc b/lib/CopyJob.cc index a736e9d..fd31eff 100644 --- a/lib/CopyJob.cc +++ b/lib/CopyJob.cc @@ -18,7 +18,7 @@ int CopyJob::Do() throw (GeneralException) { r = s->read(buffer, MIN(COPY_BUFSIZ, tr)); } catch (IOAgain e) { - Suspend(); + Suspend(TASK_ON_HOLD); } case 1: if (!r) { @@ -29,7 +29,7 @@ int CopyJob::Do() throw (GeneralException) { } catch (IOAgain e) { current = 1; - Suspend(); + Suspend(TASK_ON_HOLD); } current = 0; } diff --git a/lib/Handle.cc b/lib/Handle.cc index e158511..4124231 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -155,3 +155,7 @@ off_t Handle::GetSize(void) { time_t Handle::GetModif(void) { return -1; } + +bool Handle::CanWatch(void) { + return true; +}
\ No newline at end of file diff --git a/lib/ReadJob.cc b/lib/ReadJob.cc index 6fab08b..3083040 100644 --- a/lib/ReadJob.cc +++ b/lib/ReadJob.cc @@ -17,7 +17,7 @@ int ReadJob::Do() throw (GeneralException) { *s >> buff; } catch (IOAgain e) { - throw TaskSwitch(); + Suspend(TASK_ON_HOLD); } case 1: try { @@ -32,7 +32,7 @@ int ReadJob::Do() throw (GeneralException) { } if (!s->IsClosed()) { - throw TaskSwitch(); + Suspend(TASK_ON_HOLD); } return TASK_DONE; 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(); + } } } |