summaryrefslogtreecommitdiff
path: root/c5/wait.h
diff options
context:
space:
mode:
authorweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2002-10-04 17:31:41 +0000
committerweidai <weidai@57ff6487-cd31-0410-9ec3-f628ee90f5f0>2002-10-04 17:31:41 +0000
commitc912a49655335d3ef28d663ac4dd5e9e23640b09 (patch)
tree9c40eacb5ff5cc4e0e08aa04f54f202eff1db67a /c5/wait.h
parent3017e8f108ce3bdf2f485f195c80312032fcc14c (diff)
downloadcryptopp-c912a49655335d3ef28d663ac4dd5e9e23640b09.tar.gz
git-svn-id: svn://svn.code.sf.net/p/cryptopp/code/trunk@2 57ff6487-cd31-0410-9ec3-f628ee90f5f0
Diffstat (limited to 'c5/wait.h')
-rw-r--r--c5/wait.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/c5/wait.h b/c5/wait.h
new file mode 100644
index 0000000..a72c187
--- /dev/null
+++ b/c5/wait.h
@@ -0,0 +1,57 @@
+#ifndef CRYPTOPP_WAIT_H
+#define CRYPTOPP_WAIT_H
+
+#include "config.h"
+
+#ifdef SOCKETS_AVAILABLE
+
+#include "cryptlib.h"
+#include <vector>
+
+#ifdef USE_WINDOWS_STYLE_SOCKETS
+#include <windows.h>
+#else
+#include <sys/types.h>
+#endif
+
+NAMESPACE_BEGIN(CryptoPP)
+
+//! container of wait objects
+class WaitObjectContainer
+{
+public:
+ //! exception thrown by WaitObjectContainer
+ class Err : public Exception
+ {
+ public:
+ Err(const std::string& s) : Exception(IO_ERROR, s) {}
+ };
+
+ WaitObjectContainer();
+
+ void Clear();
+ void SetNoWait() {m_noWait = true;}
+ bool Wait(unsigned long milliseconds);
+
+#ifdef USE_WINDOWS_STYLE_SOCKETS
+ void AddHandle(HANDLE handle);
+#else
+ void AddReadFd(int fd);
+ void AddWriteFd(int fd);
+#endif
+
+private:
+#ifdef USE_WINDOWS_STYLE_SOCKETS
+ std::vector<HANDLE> m_handles;
+#else
+ fd_set m_readfds, m_writefds;
+ int m_maxFd;
+#endif
+ bool m_noWait;
+};
+
+NAMESPACE_END
+
+#endif
+
+#endif