diff options
Diffstat (limited to 'service.cpp')
-rw-r--r-- | service.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/service.cpp b/service.cpp index 742091ef..4ab59c85 100644 --- a/service.cpp +++ b/service.cpp @@ -18,15 +18,35 @@ using namespace std; int main(int argc, char** argv) { - android::sp<ArmnnDriver> driver = new ArmnnDriver(DriverOptions(argc, argv)); + android::sp<ArmnnDriver> driver; + try + { + driver = new ArmnnDriver(DriverOptions(argc, argv)); + } + catch (const std::exception& e) + { + ALOGE("Could not create driver: %s", e.what()); + return EXIT_FAILURE; + } android::hardware::configureRpcThreadpool(1, true); - if (driver->registerAsService("armnn") != android::OK) + android::status_t status = android::UNKNOWN_ERROR; + try + { + status = driver->registerAsService("armnn"); + } + catch (const std::exception& e) + { + ALOGE("Could not register service: %s", e.what()); + return EXIT_FAILURE; + } + if (status != android::OK) { ALOGE("Could not register service"); - return 1; + return EXIT_FAILURE; } + android::hardware::joinRpcThreadpool(); ALOGE("Service exited!"); - return 1; + return EXIT_FAILURE; } |