summaryrefslogtreecommitdiff
path: root/src/Handle.cc
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-11-15 17:00:03 -0800
committerPixel <pixel@nobis-crew.org>2011-11-15 17:00:03 -0800
commite72624ab203439ffea88cd55c145cdbbc57286e4 (patch)
tree5a766c74fa83441ff5ef4a744968eb6c65a7f675 /src/Handle.cc
parent36b12593e6ec34a88bde537a220e7a15f478638c (diff)
Adding a potential event to cancel a forced read/write, such as a timeout.
Diffstat (limited to 'src/Handle.cc')
-rw-r--r--src/Handle.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Handle.cc b/src/Handle.cc
index 8fa0417..839c58a 100644
--- a/src/Handle.cc
+++ b/src/Handle.cc
@@ -83,7 +83,7 @@ ssize_t Balau::Handle::write(const void * buf, size_t count) throw (GeneralExcep
return -1;
}
-ssize_t Balau::Handle::forceRead(void * _buf, size_t count) throw (GeneralException) {
+ssize_t Balau::Handle::forceRead(void * _buf, size_t count, Events::BaseEvent * evt) throw (GeneralException) {
ssize_t total;
uint8_t * buf = (uint8_t *) _buf;
if (!canRead())
@@ -95,6 +95,8 @@ ssize_t Balau::Handle::forceRead(void * _buf, size_t count) throw (GeneralExcept
r = read(buf, count);
}
catch (EAgain e) {
+ if (evt && evt->gotSignal())
+ return total;
Task::yield(e.getEvent());
continue;
}
@@ -108,7 +110,7 @@ ssize_t Balau::Handle::forceRead(void * _buf, size_t count) throw (GeneralExcept
return total;
}
-ssize_t Balau::Handle::forceWrite(const void * _buf, size_t count) throw (GeneralException) {
+ssize_t Balau::Handle::forceWrite(const void * _buf, size_t count, Events::BaseEvent * evt) throw (GeneralException) {
ssize_t total;
const uint8_t * buf = (const uint8_t *) _buf;
if (!canWrite())
@@ -120,6 +122,8 @@ ssize_t Balau::Handle::forceWrite(const void * _buf, size_t count) throw (Genera
r = write(buf, count);
}
catch (EAgain e) {
+ if (evt && evt->gotSignal())
+ return total;
Task::yield(e.getEvent());
continue;
}