Prevent holding stale Thread pointers

It is only really safe to hold non-self Thread* if you hold the
thread list lock. Changed a few places to use thread ids instead
of Thread.

Bug: 28223501

(cherry picked from commit 81c170fede9af9174aba71428334ac8f366a4b4f)

Change-Id: I15e50b699303a5c3739e4d19c153dd306e2ee504
5 files changed