add Executor::KeepAlive::copy() method
Summary: We do not want implicit copies of `KeepAlive`, because they may be accidental and they impose an overhead. However, making a copy by calling `folly::getKeepAliveToken(keep_alive.get())` does not look very nice. Also, in case that `keep_alive` is a dummy, it makes an unnecessary call to `Executor::keepAliveAcquire`, which will return false but cannot be inlined usually because it's a virtual function. This diff adds a `copy() const` method which returns a copy of the `KeepAlive` object. It only calls `Executor::keepAliveAcquire` if the original object is not a dummy. Reviewed By: yfeldblum, andriigrynenko Differential Revision: D8203839 fbshipit-source-id: bb595d3836405bd84e55c4214ac19127b1e0e42a
Showing
Please register or sign in to comment