From 49b9e100bfbb3b8da01472a0ff48b2bd92944e01 Mon Sep 17 00:00:00 2001 From: surmeh01 Date: Thu, 17 May 2018 14:11:25 +0100 Subject: Release 18.05 --- service.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'service.cpp') 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 driver = new ArmnnDriver(DriverOptions(argc, argv)); + android::sp 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; } -- cgit v1.2.1