2 // Since this is only included in Handle_Gobbler.h, these should be
3 // inline, not ACE_INLINE.
4 // FUZZ: disable check_for_inline
7 #include "ace/OS_NS_unistd.h"
8 #include "ace/OS_NS_fcntl.h"
10 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
13 ACE_Handle_Gobbler::close_remaining_handles ()
15 ACE_Handle_Set_Iterator iter (this->handle_set_);
16 for (ACE_HANDLE h = iter (); h != ACE_INVALID_HANDLE; h = iter ())
21 ACE_Handle_Gobbler::~ACE_Handle_Gobbler ()
23 this->close_remaining_handles ();
27 ACE_Handle_Gobbler::free_handles (size_t n_handles)
29 ACE_Handle_Set_Iterator iter (this->handle_set_);
30 for (ACE_HANDLE h = iter ();
31 h != ACE_INVALID_HANDLE && n_handles > 0;
32 --n_handles, h = iter ())
39 ACE_Handle_Gobbler::consume_handles (size_t n_handles_to_keep_available)
43 #if defined(ACE_WIN32)
44 // On Win32, this style of gobbling doesn't seem to work.
45 ACE_UNUSED_ARG(n_handles_to_keep_available);
51 ACE_HANDLE handle = ACE_OS::open (ACE_DEV_NULL, O_WRONLY);
53 if (handle == ACE_INVALID_HANDLE)
55 if (ACE::out_of_handles (errno))
57 result = this->free_handles (n_handles_to_keep_available);
66 if (handle >= static_cast<ACE_HANDLE>(FD_SETSIZE))
68 this->handle_set_.set_bit (handle);
71 #endif /* ACE_WIN32 */
76 ACE_END_VERSIONED_NAMESPACE_DECL