Don't attach thread before dex2oat finish creating runtime

Symptom:
Runtime is sometimes aborted when WatchDog of dex2oat is triggered by
Dex2oatWatchdogTest#TestWatchdogTrigger.

Root cause:
WatchDog of dex2oat calls Runtime::AttachCurrentThread() before dex2oat
finishes creating runtime. It causes runtime aborting.

Solution:
Don't attach thread when dex2oat doesn't finish creating runtime.

Test: make test-art-host-gtest64
Bug: 129247034
Change-Id: Ifb8a4f2c162f6185a726a987bb41495f6db440f4
1 file changed