[PATCH] D33895: [Support] Add TempFailureRetry helper function
Pavel Labath via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 16 02:28:14 PDT 2017
labath added inline comments.
================
Comment at: include/llvm/Support/Errno.h:32
+template <typename Fun, typename... Args>
+inline typename std::result_of<Fun && (Args && ...)>::type
----------------
EricWF wrote:
> The value-categories seem all messed up here. There is no reason to be using `&&` anywhere, since all of the arguments and the function are lvalues. Personally I would write this function as:
>
> ```
> template <typename Fun, typename... Args,
> typename ResultT = typename std::result_of<Fun const& (const Args&...)>::type>
> inline ResultT RetryAfterSignal(ResultT Fail, const Fun &F, const Args &... As) {
> ResultT Res;
> do
> Res = F(As...);
> while (Res == Fail && errno == EINTR);
> return Res;
> }
> ```
Thanks, that looks much better. I'll have to remember the extra template arg trick.
Using the correct value category is still somewhat of a mystery to me.
https://reviews.llvm.org/D33895
More information about the llvm-commits
mailing list