Hold a reference to ensure the eager client outlives the function data op.
PiperOrigin-RevId: 287567727 Change-Id: I86f060e22ab3ef7421c34a53f40008f418b99fa0
This commit is contained in:
parent
3ae602667e
commit
8f23523ff8
@ -131,7 +131,7 @@ void EagerClusterFunctionLibraryRuntime::Run(
|
||||
function_data = &function_data_[handle];
|
||||
}
|
||||
|
||||
EagerClient* eager_client = function_data->eager_client;
|
||||
EagerClient* eager_client = function_data->eager_client.get();
|
||||
if (eager_client == nullptr) {
|
||||
done(errors::Internal("Could not find eager client"));
|
||||
return;
|
||||
@ -195,7 +195,7 @@ void EagerClusterFunctionLibraryRuntime::CleanUp(
|
||||
function_data = &function_data_[handle];
|
||||
}
|
||||
|
||||
EagerClient* eager_client = function_data->eager_client;
|
||||
EagerClient* eager_client = function_data->eager_client.get();
|
||||
if (eager_client == nullptr) {
|
||||
done(errors::Internal("Could not find eager client"));
|
||||
return;
|
||||
|
@ -70,12 +70,16 @@ class EagerClusterFunctionLibraryRuntime
|
||||
|
||||
struct FunctionData {
|
||||
const string target;
|
||||
EagerClient* eager_client = nullptr;
|
||||
core::RefCountPtr<EagerClient> eager_client;
|
||||
std::unique_ptr<EagerOperation> op;
|
||||
|
||||
FunctionData(const string& target, EagerClient* eager_client,
|
||||
std::unique_ptr<EagerOperation> op)
|
||||
: target(target), eager_client(eager_client), op(std::move(op)) {}
|
||||
: target(target),
|
||||
eager_client(core::RefCountPtr<EagerClient>(eager_client)),
|
||||
op(std::move(op)) {
|
||||
eager_client->Ref();
|
||||
}
|
||||
};
|
||||
|
||||
mutable mutex mu_;
|
||||
|
Loading…
x
Reference in New Issue
Block a user