summaryrefslogtreecommitdiff
path: root/torch/lib
diff options
context:
space:
mode:
authorTongzhou Wang <ssnl@users.noreply.github.com>2018-11-20 23:27:16 -0800
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2018-11-20 23:31:26 -0800
commit17432a1051af457d1ef48310d64c2b45b5a1b238 (patch)
tree19e25b36f92cb4b4c8defcfac4050c8251892a09 /torch/lib
parentbb301a431da886d994fb0155185ab7567d71279d (diff)
downloadpytorch-17432a1051af457d1ef48310d64c2b45b5a1b238.tar.gz
pytorch-17432a1051af457d1ef48310d64c2b45b5a1b238.tar.bz2
pytorch-17432a1051af457d1ef48310d64c2b45b5a1b238.zip
c10d Automatically retry on EINTR (#14180)
Summary: Probably fixes https://github.com/pytorch/pytorch/issues/14170 Actually I probably shouldn't retry all `SYSCHECK` calls. I'll leave to the reviewers to decide. Pull Request resolved: https://github.com/pytorch/pytorch/pull/14180 Reviewed By: pietern Differential Revision: D13144741 Pulled By: SsnL fbshipit-source-id: d73288f76b18cae14b1b43dad4e5e8d010a96d95
Diffstat (limited to 'torch/lib')
-rw-r--r--torch/lib/c10d/Utils.hpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/torch/lib/c10d/Utils.hpp b/torch/lib/c10d/Utils.hpp
index 06e6738458..752d8e4bc6 100644
--- a/torch/lib/c10d/Utils.hpp
+++ b/torch/lib/c10d/Utils.hpp
@@ -291,9 +291,11 @@ using SizeType = uint64_t;
#define SYSCHECK(expr) \
{ \
- errno = 0; \
- auto ___output = (expr); \
- (void)___output; \
+ do { \
+ errno = 0; \
+ auto ___output = (expr); \
+ (void)___output; \
+ } while (errno == EINTR); \
if (errno != 0) \
throw std::system_error(errno, std::system_category()); \
}