mThread.join();
}
}
-#if 0 // REF-ANN
-PreparedModelCallback::PreparedModelCallback() :
- mErrorStatus(ErrorStatus::GENERAL_FAILURE), mPreparedModel(nullptr) {}
-PreparedModelCallback::~PreparedModelCallback() {}
-
-Return<void> PreparedModelCallback::notify(ErrorStatus errorStatus,
- const sp<IPreparedModel>& preparedModel) {
- mErrorStatus = errorStatus;
- mPreparedModel = preparedModel;
- CallbackBase::notify();
- return Void();
-}
-
-ErrorStatus PreparedModelCallback::getStatus() {
- wait();
- return mErrorStatus;
-}
-
-sp<IPreparedModel> PreparedModelCallback::getPreparedModel() {
- wait();
- return mPreparedModel;
-}
-#endif // REF-ANN
ExecutionCallback::ExecutionCallback() : mErrorStatus(ErrorStatus::GENERAL_FAILURE) {}
ExecutionCallback::~ExecutionCallback() {}
};
/**
- * The PreparedModelCallback class is used to receive the error status of
- * preparing a model as well as the prepared model from a task executing
- * asynchronously with respect to the runtime. If a calling thread calls wait*
- * or get* on a PreparedModelCallback object and the corresponding asynchronous
- * task has not finished preparing the model, the calling thread will block
- * until the asynchronous task has called notify. For more information on the
- * synchronization behavior, refer to the CallbackBase class.
- *
- * This class inherits the basic blocking and signaling calls from
- * CallbackBase, and implements the HIDL notify call from
- * IPreparedModelCallback. This callback object is passed as an argument to
- * IDevice::prepareModel.
- */
-#if 0 // REF-ANN
-class PreparedModelCallback : public CallbackBase, public IPreparedModelCallback {
- public:
- PreparedModelCallback();
- ~PreparedModelCallback() override;
-
- /**
- * IPreparedModelCallback::notify marks the callback object with the return
- * status of the asynchronous model preparation along with the prepared
- * model, and calls CallbackBase::notify, enabling all prior and future
- * wait* calls on the PreparedModelCallback object to proceed. For more
- * information on the synchronization behavior, refer to the CallbackBase
- * class.
- *
- * IPreparedModelCallback::notify must be called exactly once on a given
- * PreparedModelCallback object.
- *
- * @param status Error status returned from asynchronously preparing the
- * model; will be:
- * - NONE if the asynchronous preparation was successful
- * - DEVICE_UNAVAILABLE if driver is offline or busy
- * - GENERAL_FAILURE if there is an unspecified error
- * - INVALID_ARGUMENT if the input model is invalid
- * @param preparedModel Returned model that has been prepared for execution,
- * nullptr if the model was unable to be prepared.
- */
- Return<void> notify(ErrorStatus status, const sp<IPreparedModel>& preparedModel) override;
-
- /**
- * Retrieves the error status returned from the asynchronous task launched
- * by IDevice::prepareModel. If IDevice::prepareModel has not finished
- * asynchronously preparing the model, this call will block until the
- * asynchronous task notifies the object.
- *
- * @return status Error status returned from asynchronously preparing the
- * model; will be:
- * - NONE if the asynchronous preparation was successful
- * - DEVICE_UNAVAILABLE if driver is offline or busy
- * - GENERAL_FAILURE if there is an unspecified error
- * - INVALID_ARGUMENT if the input model is invalid
- */
- ErrorStatus getStatus();
-
- /**
- * Retrieves the model that has been prepared for execution from the
- * asynchronous task launched by IDevice::prepareModel. If
- * IDevice::prepareModel has not finished asynchronously preparing the
- * model, this call will block until the asynchronous task notifies the
- * object.
- *
- * @return preparedModel Returned model that has been prepared for
- * execution, nullptr if the model was unable to be
- * prepared.
- */
- sp<IPreparedModel> getPreparedModel();
-
- private:
- ErrorStatus mErrorStatus;
- sp<IPreparedModel> mPreparedModel;
-};
-#endif // REF-ANN
-
-/**
* The ExecutionCallback class is used to receive the error status of the
* execution from a task executing asynchronously with respect to the runtime.
* If a calling thread calls wait* or get* on a PreparedModelCallback object and