12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- #ifndef BOOST_SCOPE_FD_DELETER_HPP_INCLUDED_
- #define BOOST_SCOPE_FD_DELETER_HPP_INCLUDED_
- #include <boost/scope/detail/config.hpp>
- #if !defined(BOOST_WINDOWS)
- #include <unistd.h>
- #if defined(hpux) || defined(_hpux) || defined(__hpux)
- #include <cerrno>
- #endif
- #else
- #include <io.h>
- #endif
- #include <boost/scope/detail/header.hpp>
- #ifdef BOOST_HAS_PRAGMA_ONCE
- #pragma once
- #endif
- namespace boost {
- namespace scope {
- struct fd_deleter
- {
- using result_type = void;
-
- result_type operator() (int fd) const noexcept
- {
- #if !defined(BOOST_WINDOWS)
- #if defined(hpux) || defined(_hpux) || defined(__hpux)
-
-
-
-
-
-
-
- int res;
- while (true)
- {
- res = ::close(fd);
- if (BOOST_UNLIKELY(res < 0))
- {
- int err = errno;
- if (err == EINTR)
- continue;
- }
- break;
- }
- #else
- ::close(fd);
- #endif
- #else
- ::_close(fd);
- #endif
- }
- };
- }
- }
- #include <boost/scope/detail/footer.hpp>
- #endif
|