Fix bug in the way an Event handles a bound thread.

Previously, we were calling std::thread::join() from the
Event destructor.  However, if the Event's reference count
drops to zero due to action in the bound thread, then the
bound thread calls the Event's destructor, and tries to
join itself; this throws an exception, and produces a
message like

  terminating with uncaught exception of type std::__1::system_error:
  thread::join failed: Resource deadlock would occur

However, we do not seem to have had any test cases that actully
call ANeuralNetworksEvent_free(), so every Event would leak, and
we never hit this problem.

Now also change Request::compute() to stop leaking its event -- doing
this without changing bound thread handling would produce the exception
shown above.

Bug: 63905942
Test: nn/runtime/tests
Change-Id: I0d9370d187c10be00a4a69db8eb5f79854c9be12
3 files changed
tree: fc0cbcd4f352b2392114648cd5dd0cab35d9c323
  1. nn/
  2. Android.bp