aboutsummaryrefslogtreecommitdiffstats
path: root/lib/iowatch.h
diff options
context:
space:
mode:
authorFritz Elfert <felfert@to.com>2000-08-07 23:42:40 +0000
committerFritz Elfert <felfert@to.com>2000-08-07 23:42:40 +0000
commit68d5fd192fee358ad195c32b47333f8f87ae13f2 (patch)
tree59f865b9679830a006c5c35fb13dcf8f81b85099 /lib/iowatch.h
parent50dee0db8d5117ed3b9691140ceb02d8aac292d1 (diff)
downloadplptools-68d5fd192fee358ad195c32b47333f8f87ae13f2.tar.gz
plptools-68d5fd192fee358ad195c32b47333f8f87ae13f2.tar.bz2
plptools-68d5fd192fee358ad195c32b47333f8f87ae13f2.zip
General cleanup:
- Corrected some operators of bufferArray - Added more constructors to PsiTime - Added one more fallback for Timezone calculation in PsiTime - Use PsiTime in rfsv - Moved some common methods from rfsv16/32 to rfsv - Added more kdoc comments. - Made interface more robust (added const whereever possible, changed pointer arguments to references)
Diffstat (limited to 'lib/iowatch.h')
-rw-r--r--lib/iowatch.h58
1 files changed, 48 insertions, 10 deletions
diff --git a/lib/iowatch.h b/lib/iowatch.h
index 18c0d44..a578e05 100644
--- a/lib/iowatch.h
+++ b/lib/iowatch.h
@@ -3,19 +3,57 @@
#include "bool.h"
+/**
+ * A simple wrapper for select()
+ *
+ * IOWatch is a simple wrapper for the select
+ * system call. In particular, it takes care
+ * of passing the maximum file descriptor
+ * argument (arg 1) of select() correctly.
+ * IOWatch handles select on read descriptors only.
+ */
class IOWatch {
public:
- IOWatch();
- ~IOWatch();
-
- void addIO(int a);
- void remIO(int a);
- bool watch(long secs, long usecs);
-private:
+ /**
+ * Creates a new instance.
+ */
+ IOWatch();
+
+ /**
+ * Destroys an instance.
+ */
+ ~IOWatch();
+
+ /**
+ * Adds a file descriptor to
+ * the set of descriptors.
+ *
+ * @param fd The file descriptor to add.
+ */
+ void addIO(const int fd);
+
+ /**
+ * Removes a file descriptor from the
+ * set of descriptors.
+ *
+ * @param fd The file descriptor to remove.
+ */
+ void remIO(const int fd);
- enum consts { MAX_IO = 20 };
- int *io;
- int num;
+ /**
+ * Performs a select() call.
+ *
+ * @param secs Number of seconds to wait.
+ * @param usecs Number of microseconds to wait.
+ *
+ * @return true, if any of the descriptors is
+ * readable.
+ */
+ bool watch(const long secs, const long usecs);
+
+private:
+ int num;
+ int *io;
};
#endif