An inactive but alive thread shouldn't prevent cleanup 1. Acquire EGL global lock before thread cleanup and remove all clean up related mutexes 2. Mark contexts that are not current as invalid during terminate 3. During thread exit, if there are other active threads, terminate with TerminateReason::InternalCleanup. This gives an opportunity for well behaved threads to cleanup up invalid objects. Bug: angleproject:6723 Bug: angleproject:6798 Test: EGLContextSharingTestNoFixture.InactiveThreadDoesntPreventCleanup* Change-Id: I418e5f8b486d3d309bd58c4cfb04b7dc1149ffc1 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3768667 Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org> Reviewed-by: Roman Lavrov <romanl@google.com> Commit-Queue: mohan maiya <m.maiya@samsung.com>