summaryrefslogtreecommitdiff
path: root/lib/Handle.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Handle.cc')
-rw-r--r--lib/Handle.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/Handle.cc b/lib/Handle.cc
index c1fbc8c..e5a23a3 100644
--- a/lib/Handle.cc
+++ b/lib/Handle.cc
@@ -20,7 +20,7 @@ int Handle::GetHandle() {
return h;
}
-ssize_t Handle::write(const void *buf, size_t count) throw (IOGeneral) {
+ssize_t Handle::write(const void *buf, size_t count) throw (GeneralException) {
ssize_t r, tr = 0;
bool done, full = false;
@@ -40,7 +40,7 @@ ssize_t Handle::write(const void *buf, size_t count) throw (IOGeneral) {
done = false;
full = true;
if (nonblock) {
- throw IOAgain();
+ throw TaskSwitch();
} else {
sleep(1);
}
@@ -58,19 +58,16 @@ ssize_t Handle::write(const void *buf, size_t count) throw (IOGeneral) {
return r + tr;
}
-ssize_t Handle::read(void *buf, size_t count) throw (IOGeneral) {
+ssize_t Handle::read(void *buf, size_t count) throw (GeneralException) {
ssize_t r;
errno = 0;
if ((r = ::read(h, buf, count)) < 0) {
- cerr << "read: throwing exception...\n";
if ((!errno) || (errno = EAGAIN)) {
// Avant de déclarer une erreur, on vérifie si ce n'est pas un
// problème lié au fait qu'il n'y a plus d'octets.
- cerr << "Throwing a 'again' exception.\n";
- throw IOAgain();
+ throw TaskSwitch();
} else {
- cerr << "Throwing an unknow exception.\n";
throw IOException(GetName(), IO_READ, count);
}
}