summaryrefslogtreecommitdiff
path: root/lib/Handle.cc
diff options
context:
space:
mode:
authorPixel <Pixel>2001-11-09 14:06:58 +0000
committerPixel <Pixel>2001-11-09 14:06:58 +0000
commit823761df28ad31cde8a071125b177f49494d804a (patch)
tree9e063f7eb4d5ad48039e957f0ec7d5c70fcefe0d /lib/Handle.cc
parent69d9cab0c415837552a84f17366356e9571fdbda (diff)
Exceptions...
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);
}
}