X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=include%2Fllvm%2FSupport%2FErrno.h;h=35dc1ea7cf84fe2ff65d4b8ff88d6d77a080f8c5;hb=d04333d38b;hp=8e145c7b0b51284d5219f73686eb6309684e9282;hpb=674be02d525d4e24bc6943ed9274958c580bcfbc;p=android-x86%2Fexternal-llvm.git diff --git a/include/llvm/Support/Errno.h b/include/llvm/Support/Errno.h index 8e145c7b0b5..35dc1ea7cf8 100644 --- a/include/llvm/Support/Errno.h +++ b/include/llvm/Support/Errno.h @@ -14,7 +14,9 @@ #ifndef LLVM_SUPPORT_ERRNO_H #define LLVM_SUPPORT_ERRNO_H +#include #include +#include namespace llvm { namespace sys { @@ -28,6 +30,16 @@ std::string StrError(); /// Like the no-argument version above, but uses \p errnum instead of errno. std::string StrError(int errnum); +template +inline auto RetryAfterSignal(const FailT &Fail, const Fun &F, + const Args &... As) -> decltype(F(As...)) { + decltype(F(As...)) Res; + do + Res = F(As...); + while (Res == Fail && errno == EINTR); + return Res; +} + } // namespace sys } // namespace llvm