From 68d5fd192fee358ad195c32b47333f8f87ae13f2 Mon Sep 17 00:00:00 2001 From: Fritz Elfert Date: Mon, 7 Aug 2000 23:42:40 +0000 Subject: 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) --- lib/iowatch.h | 58 ++++++++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 48 insertions(+), 10 deletions(-) (limited to 'lib/iowatch.h') 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 -- cgit v1.2.3