Skip to content

Commit

Permalink
Add a warning about using "GetPtr"
Browse files Browse the repository at this point in the history
  • Loading branch information
Tabrizian committed May 17, 2023
1 parent ecf63bd commit 2b8898c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/infer_payload.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ class InferPayload : public std::enable_shared_from_this<InferPayload> {
const bool is_decouple,
std::function<void(std::unique_ptr<InferResponse>)> callback);

/// GetPtr should be only called when the InferPayload object is constructed
/// using a shared pointer. Calling this function in any other circumstance
/// is undefined behaviour until C++17.
std::shared_ptr<InferPayload> GetPtr() { return shared_from_this(); }
void SetValue(std::unique_ptr<InferResponse> infer_response);
void SetFuture(std::future<std::unique_ptr<InferResponse>>& response_future);
Expand Down

0 comments on commit 2b8898c

Please sign in to comment.