summaryrefslogtreecommitdiff
path: root/ace/Handle_Gobbler.h
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-22 07:32:05 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1999-07-22 07:32:05 +0000
commit9cc3d836eef7e45e68db52f59016aff22835d12e (patch)
tree0aec127460ba41c5aa1b565e0cf624874bbc0669 /ace/Handle_Gobbler.h
parentb77d0bb15156c7e8d717257b9e817f239524b14a (diff)
downloadATCD-9cc3d836eef7e45e68db52f59016aff22835d12e.tar.gz
ChangeLogTag:Thu Jul 22 02:15:46 1999 Irfan Pyarali <irfan@cs.wustl.edu>
Diffstat (limited to 'ace/Handle_Gobbler.h')
-rw-r--r--ace/Handle_Gobbler.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/ace/Handle_Gobbler.h b/ace/Handle_Gobbler.h
new file mode 100644
index 00000000000..9f9dbe7ceb7
--- /dev/null
+++ b/ace/Handle_Gobbler.h
@@ -0,0 +1,63 @@
+// $Id$
+
+// ============================================================================
+//
+// = LIBRARY
+// ace
+//
+// = FILENAME
+// Handle_Gobbler.h
+//
+// = AUTHOR
+// Kirthika Parameswaran <kirthika@cs.wustl.edu>
+// Irfan Pyarali <irfan@cs.wustl.edu>
+//
+// ============================================================================
+
+#ifndef ACE_HANDLE_GOBBLER_H
+#define ACE_HANDLE_GOBBLER_H
+
+#include "ace/OS.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+# pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include "ace/Containers_T.h"
+
+class ACE_Handle_Gobbler
+{
+ // = TITLE
+ // This class gobbles up handles.
+ //
+ // = DESCRIPTION
+ // This is useful when we need to control the number of handles
+ // available for a process. This class is mostly used for
+ // testing purposes.
+public:
+
+ ~ACE_Handle_Gobbler (void);
+ // Destructor. Cleans up any remaining handles.
+
+ int consume_handles (size_t n_handles_to_keep_available);
+ // Handles are opened continously until the process runs out of
+ // them, and then <n_handles_to_keep_available> handles are closed
+ // (freed) thereby making them usable in the future.
+
+ int free_handles (size_t n_handles);
+ // Free up <n_handles>.
+
+ void close_remaining_handles (void);
+ // All remaining handles are closed.
+
+private:
+
+ typedef ACE_Unbounded_Set<ACE_HANDLE> HANDLE_SET;
+
+ HANDLE_SET handle_set_;
+ // The container which holds the open descriptors.
+};
+
+#include "ace/Handle_Gobbler.i"
+
+#endif /* ACE_HANDLE_GOBBLER_H */