[PATCH] D33895: [Support] Add TempFailureRetry helper function

Eric Fiselier via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 15 12:59:45 PDT 2017


EricWF added inline comments.


================
Comment at: include/llvm/Support/Errno.h:32
 
+template <typename Fun, typename... Args>
+inline typename std::result_of<Fun && (Args && ...)>::type
----------------
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;
}
```


https://reviews.llvm.org/D33895





More information about the llvm-commits mailing list