3 //=============================================================================
5 * @file Handle_Gobbler.h
7 * @author Kirthika Parameswaran <kirthika@cs.wustl.edu>
8 * @author Irfan Pyarali <irfan@cs.wustl.edu>
10 //=============================================================================
13 #ifndef ACE_HANDLE_GOBBLER_H
14 #define ACE_HANDLE_GOBBLER_H
15 #include /**/ "ace/pre.h"
17 #include "ace/Handle_Set.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
26 * @class ACE_Handle_Gobbler
28 * @brief This class gobbles up handles.
30 * This is useful when we need to control the number of handles
31 * available for a process. This class is mostly used for
34 class ACE_Handle_Gobbler
37 /// Destructor. Cleans up any remaining handles.
38 inline ~ACE_Handle_Gobbler ();
41 * Handles are opened continuously until the process runs out of
42 * them, and then @a n_handles_to_keep_available handles are closed
43 * (freed) thereby making them usable in the future.
45 inline int consume_handles (size_t n_handles_to_keep_available
);
47 /// Free up @a n_handles.
48 inline int free_handles (size_t n_handles
);
50 /// All remaining handles are closed.
51 inline void close_remaining_handles ();
54 typedef ACE_Handle_Set HANDLE_SET
;
56 /// The container which holds the open descriptors.
57 HANDLE_SET handle_set_
;
60 ACE_END_VERSIONED_NAMESPACE_DECL
62 #include "ace/Handle_Gobbler.inl"
64 #include /**/ "ace/post.h"
65 #endif /* ACE_HANDLE_GOBBLER_H */