[jit] Add return statement back to Future::addCallback() (#36662)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/36662
This was a mistake from an earlier change, though the expected impact is
relatively minimal - mostly keeping callback around longer than necessary
in the case of callbacks already-completed futures.
ghstack-source-id: 102203224
Test Plan: buck test mode/dev-nosan caffe2/test/...
Differential Revision: D21044145
fbshipit-source-id: f3bd58bd6bde83caaa7b9bd0385d0ce3647dbc05
diff --git a/torch/csrc/utils/future.h b/torch/csrc/utils/future.h
index 0949718..82507da 100644
--- a/torch/csrc/utils/future.h
+++ b/torch/csrc/utils/future.h
@@ -124,6 +124,7 @@
if (completed_) {
lock.unlock();
cb();
+ return;
}
callbacks_.emplace_back(std::move(cb));
}